1
votes

After adding Android to an iOS-only Cordova project, cordova build fails with

Error: Cannot find module 'lodash/object/assign'

I am aware of this question, but there is no xmlbuilder in my plist directory in the globally installed cordova module (/usr/local). So I am unable to try that quick and dirty solution.

The problem persists even after removing Android and re-running cordova build. I'm not aware of having made any changes to the project since last running cordova build except for a tiny change to a js file in www.

Versions: cordova -v: 5.4.1, node -v: v4.2.4, npm -v lodash: 2.14.12 (if that's even the one used here),

cordova plugins list: cordova-hot-code-push-plugin 1.2.5 "Hot Code Push Plugin" cordova-media-with-compression 2.0.15 "Media With Compression: Alpha Software Edition" cordova-plugin-customurlscheme 4.1.3 "Custom URL scheme" cordova-plugin-device 1.1.1 "Device" cordova-plugin-dialogs 1.2.0 "Notification" cordova-plugin-file 4.1.1 "File" cordova-plugin-inappbrowser 1.3.0 "InAppBrowser" cordova-plugin-iosrtc 2.2.2 "iosrtc" cordova-plugin-media-capture 1.2.1-dev "Capture" cordova-plugin-whitelist 1.2.1 "Whitelist" cordova-plugin-x-socialsharing 5.0.10 "SocialSharing" cordova-universal-links-plugin 1.1.0 "Universal Links Plugin" ionic-plugin-keyboard 1.0.8 "Keyboard" phonegap-plugin-push 1.5.3 "PushPlugin"

1
For the new version the right folder for assign module is "cordova\node_modules\cordova-lib\node_modules\lodash\object\", please check if file "assign.js" is still there or not. - Elvis Xia - MSFT
/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/lodash/object/assign.js exists... - nexus
Have you tried using "npm install -g [email protected]" to reinstall the cordova of version 5.4.1? - Elvis Xia - MSFT
Just did so, but the problem persists... - nexus

1 Answers

0
votes

Turns out it seems to be an issue with a plugin.

I created a separate blank project, added all plugins, added the android platform, then "cordova build" and – boom – the same response again. I then removed them one by one and always removed and added android afterwards, and built again until the error message disappeared.

Then, I just uninstalled that plugin in my main project, added android, and installed the plugin again. The error message has since disappeared.

Maybe this is helpful for someone.