Comments (10)
In my case it only worked when I did
npm install xcode -g
from cordova-lib.
@brodybits the problem here is that we basically encouraged this kind of thing with Context.requireCordovaModule
. At least for Cordova 8, adding the dependency to xcode
back would be the right thing to do from a semver perspective. Actually, if we wanted to do it the right way, we would have to restore any other dependency we dropped or changed a version of. These are basically all major semver changes with Context.requireCordovaModule
.
Which is why Context.requireCordovaModule
is so ridiculously bad and the reason I suggested to deprecate that method a while ago in #689.
from cordova-lib.
I can see the logic.
Since the workaround is pretty straight forward (npm install ) this can be easily overcome with a deprecation message & documentation.
A clear message of library xyz is relying on package abc which is no longer provided by cordova. Run npm install abc yourself
could do magic to cordova developers hours of work and sanity...
from cordova-lib.
Can you please give us some more information:
- result of
node --version
- result of
npm --version
- command you used to add iOS platform
cordova platform add ios
works fine for me in my local clone of https://github.com/brodybits/cordova-dialogs-bootstrap-test
cordova run ios --device
(with my own package ID) and cordova emulate ios
also work fine for me
from cordova-lib.
I have created a repo for the error: https://github.com/Tallyb/cordova-xcode-error (based on your repo)
Node 10.11.0, npm 6.4.1 (latest and greatest...)
I have installed cordova locall (npm i -D cordova
). I have multiple version that are not compliant, so I must have cordova installed locally. Installed 8.1.0
The problem was with few plugins, one of them was branch-cordova-sdk.
$(npm bin)/cordova platform add ios
Here is the error:
Failed to install 'branch-cordova-sdk': Error: Cannot find module 'xcode'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Context.requireCordovaModule (/Users/tallyb/Documents/dev/cordova-dialogs-bootstrap-test/node_modules/cordova-lib/src/hooks/Context.js:77:12)
at getProjectModuleGlob (/Users/tallyb/Documents/dev/cordova-dialogs-bootstrap-test/plugins/branch-cordova-sdk/src/scripts/npm/processConfigXml.js:159:31)
at getProjectModule (/Users/tallyb/Documents/dev/cordova-dialogs-bootstrap-test/plugins/branch-cordova-sdk/src/scripts/npm/processConfigXml.js:145:16)
at getBranchPreferences (/Users/tallyb/Documents/dev/cordova-dialogs-bootstrap-test/plugins/branch-cordova-sdk/src/scripts/npm/processConfigXml.js:64:25)
at Object.read (/Users/tallyb/Documents/dev/cordova-dialogs-bootstrap-test/plugins/branch-cordova-sdk/src/scripts/npm/processConfigXml.js:17:31)
at run (/Users/tallyb/Documents/dev/cordova-dialogs-bootstrap-test/plugins/branch-cordova-sdk/src/scripts/hooks/beforePrepare.js:15:43)
Cannot find module 'xcode'
npm i -S xcode
and redo - error is gone (you get team error, but this is because I put a fake id...). You can switch to valid configuration and retest.
from cordova-lib.
I think the explanation is that branch-cordova-sdk
uses xcode
without explicitly declaring it as a dependency, which happened to work since cordova-lib
had the extra xcode
dependency. I would be happy to make a workaround solution for Cordova 8.1.x but this extra xcode
dependency will definitely not be supported in upcoming Cordova 9. More explanation is coming soon.
from cordova-lib.
At least for Cordova 8, adding the dependency to
xcode
back would be the right thing to do from a semver perspective.
Will do
Actually, if we wanted to do it the right way, we would have to restore any other dependency we dropped or changed a version of. These are basically all major semver changes with
Context.requireCordovaModule
.
Agreed for any other dependency dropped or major version changed. But for request
, while we dropped exact version 2.79.0
I think we should just add request@2
which should not reintroduce any npm audit
warnings. Keep in mind that this was a minor release (as opposed to a patch release).
from cordova-lib.
Well said @Tallyb, my deepest apologies for such a bad mess-up. I just raised PR #708 with a hotfix, as needed to follow proper semver etiquette (semver/semver#461).
from cordova-lib.
@deliverymanager Yes, if you have a global installation of Cordova you also have to install xcode globally to work around this issue. Thanks for pointing that out.
A patch for this is underway.
from cordova-lib.
This issue is now resolved in [email protected]
and [email protected]
, closing now. Please keep in mind that we are planning to deprecate this form of usage and completely drop support in a new release as discussed in #689.
We would strongly advise all plugins and applications to explicitly include xcode
in dependencies
(or devDependencies
, if appropriate) and use require('xcode')
instead of requireCordovaModule('xcode
)` asap.
In case of any questions please do not hesitate to ask via [email protected], [email protected], or in a new Cordova issue (https://github.com/apache/cordova/issues).
from cordova-lib.
Related Issues (20)
- Cordova does not support subfolders, when using semver
- Cordova platform add android, removes node modules with semver HOT 3
- Improve how Cordova checks for required project information HOT 1
- plugin.xml <dependency> tag commit attribute doesn't work as documented for branches HOT 1
- cordova prepare not resolving platform specification correctly for devDependency HOT 1
- NodeJS14: Warning: Accessing non-existent property 'android' HOT 3
- Unable to remove a plugin using a not officially supported platform HOT 1
- Process.env variables are not present in hooks HOT 1
- Cordova doesn't work with NPM 7 HOT 15
- Failure to install plugin with url#git_ref:subdir spec HOT 1
- One test fails on CI HOT 1
- Wrong platform version is detected when dependencies and devDependencies are both present HOT 1
- Fail to add plugin with prerelease version because of "Invalid Version" HOT 1
- Dependencies are wiped on each step of project creation with cordova-lib and NPM 7 HOT 2
- Question About API 24 And API 30 And Question About How Make Jar Using Cordova 9.1.0 And Cordova 10.0.0 (Solution for jcenter() deprecated) HOT 1
- restore-util doesn't properly find platform spec info
- Adding plugins for only specific platforms HOT 10
- Cordova uses the wrong working directory and loads top-level config.xml HOT 1
- Bug(tests): Test#012 failure HOT 5
- Why cordova-android 12.0.0 is not used ? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-lib.