Giter VIP home page Giter VIP logo

Comments (10)

deliverymanager avatar deliverymanager commented on May 31, 2024 6

In my case it only worked when I did
npm install xcode -g

from cordova-lib.

raphinesse avatar raphinesse commented on May 31, 2024 1

@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.

Tallyb avatar Tallyb commented on May 31, 2024 1

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.

brodybits avatar brodybits commented on May 31, 2024

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.

Tallyb avatar Tallyb commented on May 31, 2024

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.

brodybits avatar brodybits commented on May 31, 2024

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.

brodybits avatar brodybits commented on May 31, 2024

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.

brodybits avatar brodybits commented on May 31, 2024

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.

raphinesse avatar raphinesse commented on May 31, 2024

@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.

brodybits avatar brodybits commented on May 31, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.