Ionic-cli: Cannot find module 'lodash/assign'

Created on 9 Jan 2017  路  12Comments  路  Source: ionic-team/ionic-cli

When iam doing ionic serve returning an error

D:\Gayathri\workspace\MobileHtml>ionic serve
Caught exception:
Error: Cannot find module 'lodash/assign'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (C:\Users\gayathri.b\AppData\Roaming\npm\node_modules\
ionic\node_modules\xmlbuilder\lib\index.js:5:12)
at Object. (C:\Users\gayathri.b\AppData\Roaming\npm\node_modules\
ionic\node_modules\xmlbuilder\lib\index.js:14:4)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)

old major version

Most helpful comment

Finally i fixed it with:

npm uninstall -g ionic cordova
npm cache clean
npm install -g ionic cordova

All 12 comments

Same error here

Caught exception:
Error: Cannot find module 'lodash/assign'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object. (C:\Users\USUARIO\AppData\Roaming\npm\node_modules\ionic\node_modules\xmlbuilder\lib\index.js:
5:12)
at Object. (C:\Users\USUARIO\AppData\Roaming\npm\node_modules\ionic\node_modules\xmlbuilder\lib\index.js:
14:4)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)

Could you provide me with the output from ionic info from within your project directory? Thanks, this should help in troubleshooting.

Finally i fixed it with:

npm uninstall -g ionic cordova
npm cache clean
npm install -g ionic cordova

@aperezcoinpre those steps fixed the error on my side as well.

Thanks for the help, but it didn't help on my side. I can't even run ionic info because it throws the same "cannot find module 'lodash/assign', here's the full error:

_Caught exception:
 Error: Cannot find module 'lodash/assign'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\admin\AppData\Roaming\npm\node_modules\ionic\node_modules\xmlbuilder\lib\index.js:5:12)
    at Object.<anonymous> (C:\Users\admin\AppData\Roaming\npm\node_modules\ionic\node_modules\xmlbuilder\lib\index.js:14:4)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)_

Thanks in advance for your help.

Same issue here. Trying to create an ionic project fails on this error. Steps proposed by @aperezcoinpre did not fix the issue. I'm using node 6.9.4, npm 3.10.10. Latest version of ionic, however all ionic cli commands fail with same error as @jrivera-technisys

Fixed the issue by completely removing node and npm (http://stackoverflow.com/questions/20711240/how-to-completely-remove-node-js-from-windows) and reinstalling node. I think my npm cache in my user profile must have been corrupt somehow.

@jrivera-technisys @jimwheaton, Check if this works

npm i --save lodash.assign

@JacobbV Thanks for the suggestion, but I tried that with no success. As mentioned in my last comment, I was able to fix the issue by completely wiping node/npm and reinstalling. I suspect it was an npm cache issue.

Same erro here
_Error: Cannot find module 'lodash/assign'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (C:\Users\rodrigo.dias.CO\AppData\Roaming\npm\node_modules\ionic\node_modules\xmlbuilder\lib\index.js:5:12)
at Object. (C:\Users\rodrigo.dias.CO\AppData\Roaming\npm\node_modules\ionic\node_modules\xmlbuilder\lib\index.js:14:4)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)_

Hello

If anyone else is still having this problem, this worked for me:

  1. Uninstall Ionic
    npm uninstall -g ionic cordova
  1. Uninstall Node
  2. Reinstall Node (I downloaded the latest version)
  3. Clear cache
    npm cache clean

  4. Reinstall Ionic
    npm install -g ionic cordova

That worked for me. I tried the exact same thing but without uninstalling Node first and it didn't work.

Thanks to @aperezcoinpre 馃挴
Hope this helps

Thanks for the issue! This issue appears to be associated with an old version of the Ionic CLI. Please update to the latest CLI version, which supports all versions of the Ionic Framework. If the issue is relevant and if it persists after updating to the latest CLI version, please create a new issue.

Thank you for using Ionic!

Was this page helpful?
0 / 5 - 0 ratings