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

All of a sudden (after updating node/npm LTS and cordova to 8.1.2), upon 'cordova run android', "Error loading dependencies (Cannot find module 'tostr') - attempting to resolve" - must install all deps by hand now #159

Closed atljoseph closed 5 years ago

atljoseph commented 5 years ago

Node LTS 10.15.3 (with packaged NPM version) Cordova CLI 8.1.2

When running cordova run android, Cordova complained about:

The output indicated that it was going to install the dependencies, but it hung and never resolved. Annoying ...

Never seen this before. Nothing changed that I can tell, even the version of cordova-custom-config.

atljoseph commented 5 years ago

This happened when the plugin updated from 3.1.4 to 3.3.0.

dpa99c commented 5 years ago

Works fine for me with node 10.3.5 (see console output below). I would speculate that upgrading node has screwed up the node_modules in your Cordova project. I would try rm -Rf node_modules && npm install and see if that resolves it.

console output ``` $ node -v v10.15.3 $ cordova -v 9.0.0 (cordova-lib@9.0.1) $ cordova create test && cd test Creating a new cordova project. $ cordova plugin add cordova-custom-config@latest Adding cordova-custom-config to package.json $ cordova platform add android@latest Using cordova-fetch for cordova-android@latest Adding android project... Creating Cordova project for the Android platform: Path: platforms\android Package: io.cordova.hellocordova Name: HelloCordova Activity: MainActivity Android target: android-28 Subproject Path: CordovaLib Subproject Path: app Android project created with cordova-android@8.0.0 Installing "cordova-custom-config" for android cordova-custom-config: Skipping auto-restore of config file backup(s) Plugin 'cordova-plugin-whitelist' found in config.xml... Migrating it to package.json Discovered saved plugin "cordova-plugin-whitelist". Adding it to the project Installing "cordova-plugin-whitelist" for android This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in. Adding cordova-plugin-whitelist to package.json $ cordova build android cordova-custom-config: Skipping auto-restore of config file backup(s) Checking Java JDK and Android SDK versions ANDROID_SDK_ROOT=C:\Users\dpa99\AppData\Local\Android\sdk (recommended setting) ANDROID_HOME=C:\Users\dpa99\AppData\Local\Android\sdk (DEPRECATED) Starting a Gradle Daemon (subsequent builds will be faster) BUILD SUCCESSFUL in 2s 1 actionable task: 1 executed Subproject Path: CordovaLib Subproject Path: app Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details > Configure project :app Observed package id 'build-tools;28.0.3' in inconsistent location 'C:\Users\dpa99\AppData\Local\Android\sdk\build-tools\current' (Expected 'C:\Users\dpa99\AppData\Local\Android\sdk\build-tools\28.0.3') Already observed package id 'build-tools;28.0.3' in 'C:\Users\dpa99\AppData\Local\Android\sdk\build-tools\28.0.3'. Skipping duplicate at 'C:\Users\dpa99\AppData\Local\Android\sdk\build-tools\current' > Task :app:preBuild UP-TO-DATE > Task :CordovaLib:preBuild UP-TO-DATE > Task :CordovaLib:preDebugBuild UP-TO-DATE > Task :CordovaLib:checkDebugManifest > Task :CordovaLib:processDebugManifest > Task :app:preDebugBuild > Task :CordovaLib:compileDebugAidl NO-SOURCE > Task :app:compileDebugAidl NO-SOURCE > Task :CordovaLib:packageDebugRenderscript NO-SOURCE > Task :app:compileDebugRenderscript > Task :app:checkDebugManifest > Task :app:generateDebugBuildConfig > Task :app:prepareLintJar > Task :app:generateDebugSources > Task :CordovaLib:compileDebugRenderscript > Task :CordovaLib:generateDebugBuildConfig > Task :CordovaLib:generateDebugResValues > Task :CordovaLib:generateDebugResources > Task :CordovaLib:packageDebugResources > Task :CordovaLib:generateDebugRFile > Task :CordovaLib:prepareLintJar > Task :CordovaLib:generateDebugSources > Task :CordovaLib:javaPreCompileDebug Note: D:\Temp\test\platforms\android\CordovaLib\src\org\apache\cordova\engine\SystemCookieManager.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. > Task :CordovaLib:compileDebugJavaWithJavac > Task :CordovaLib:processDebugJavaRes NO-SOURCE > Task :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug > Task :app:javaPreCompileDebug > Task :app:mainApkListPersistenceDebug > Task :app:generateDebugResValues > Task :app:generateDebugResources > Task :app:mergeDebugResources > Task :app:createDebugCompatibleScreenManifests > Task :app:processDebugManifest > Task :app:processDebugResources > Task :app:compileDebugJavaWithJavac > Task :app:compileDebugNdk NO-SOURCE > Task :app:compileDebugSources > Task :app:mergeDebugShaders > Task :app:compileDebugShaders > Task :app:generateDebugAssets > Task :CordovaLib:mergeDebugShaders > Task :CordovaLib:compileDebugShaders > Task :CordovaLib:generateDebugAssets > Task :CordovaLib:packageDebugAssets > Task :app:mergeDebugAssets > Task :app:validateSigningDebug > Task :app:signingConfigWriterDebug > Task :app:transformClassesWithDexBuilderForDebug > Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug > Task :app:transformDexArchiveWithDexMergerForDebug > Task :app:mergeDebugJniLibFolders > Task :CordovaLib:compileDebugNdk NO-SOURCE > Task :CordovaLib:mergeDebugJniLibFolders > Task :CordovaLib:transformNativeLibsWithMergeJniLibsForDebug > Task :CordovaLib:transformNativeLibsWithStripDebugSymbolForDebug > Task :CordovaLib:transformNativeLibsWithIntermediateJniLibsForDebug > Task :app:transformNativeLibsWithMergeJniLibsForDebug > Task :app:transformNativeLibsWithStripDebugSymbolForDebug > Task :app:processDebugJavaRes NO-SOURCE > Task :app:transformResourcesWithMergeJavaResForDebug > Task :app:packageDebug > Task :app:assembleDebug > Task :app:cdvBuildDebug BUILD SUCCESSFUL in 12s 44 actionable tasks: 44 executed Built the following apk(s): D:\Temp\test\platforms\android\app\build\outputs\apk\debug\app-debug.apk ```
atljoseph commented 5 years ago

That was the first troubleshooting step. Did not resolve the issue.

Sent from my iPhone

On May 10, 2019, at 4:31 AM, Dave Alden notifications@github.com wrote:

Works fine for me with node 10.3.5 (see console output below). I would speculate that upgrading node has screwed up the node_modules in your Cordova project. I would try rm -Rf node_modules && npm install and see if that resolves it.

console output — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

dpa99c commented 5 years ago

Try a clean project, i.e. repeat the commands in the console output above and post the full console output.

atljoseph commented 5 years ago

Yeah, we just added the 3-4 modules it was complaining about explicitly to the package json. Was not worth the effort for us troubleshoot this issue. Mostly just an annoyance, because we had to manually install the module’s internal dependencies out of the blue one day.

Sent from my iPhone

On May 16, 2019, at 7:04 AM, Dave Alden notifications@github.com wrote:

Try a clean project, i.e. repeat the commands in the console output above and post the full console output.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

dpa99c commented 5 years ago

Closing as OP not willing to investigate further