dpa99c / cordova-custom-config

Cordova/Phonegap plugin to update platform configuration files based on preferences and config-file data defined in config.xml
318 stars 84 forks source link

Missing dependency error #144

Closed alain-sarti closed 6 years ago

alain-sarti commented 6 years ago

I'm submitting a ... (check one with "x"):

Bug report

Current behavior:

We have a MacBook as a dedicated build machine and the local developer MacBooks. On my local MacBook the plugin works as intended, which is awesome. But after that I push the changes to the git repository, our MacBook checks the branch out into an empty directory and runs npm install, followed by adding the ios platform and building it. So it's just another local machine in that regard. But the build machine cannot build an ios app.

The error is:

Error: cordova-custom-config: Error loading dependencies for applyCustomConfig.js - ensure the plugin has been installed via cordova-fetch or run 'npm install cordova-custom-config': Cannot find module 'simple-plist'

Even if I ssh onto that MacBook and install the plugin, it does not run. The node_modules folder does contain the simple-plist module.

Expected behavior:

It should run just like on my local machine :)

Environment information

iOS build issue:

Related code:

<custom-preference name="ios-XCBuildConfiguration-IPHONEOS_DEPLOYMENT_TARGET" value="10.0" />

Other information: Thanks in advance!

dpa99c commented 6 years ago

This plugin relies on the Cordova plugin installation process, which since cordova@7 uses npm install to install plugins to the project via cordova-fetch and in doing so to satisfy the plugin dependencies.

This missing dependency error being raised because the script is failing to load required dependent node modules.

As you can see from the plugin's dependency list, simple-plist is not a direct dependency of the plugin, however from npm list I can see it's a dependency of the xcode module, which is a direct dependency.

Therefore, I would say that something in your build environment is causing npm install to not satisfy that dependency and that's not something that I can resolve by making code changes to this plugin, since it's simply relying on Cordova/NPM to satisfy its dependencies.

alain-sarti commented 6 years ago

Thank you for your input. I will have a look if there is something different on the build macbook.

I was sure that there seems to be a problem, since all the versions are identical on both systems and on the one it works on the other it doesn't.

alain-sarti commented 6 years ago

Okay, one last question. I asked a colleague to check out the repo, use npm install on his machine and it didn't work, too.

Are there any special steps to share a project with someone else if I want to use the plugin?

Thanks in advance :)

alain-sarti commented 6 years ago

Okay, the solution was for the macbook to remove the node_modules folder, to remove the platform and add the platform.

Very strange behaviour :/ But definately npm related

dfa1234 commented 6 years ago

For me the solution was to enter cd plugins/cordova-custom-config And to npm i there.