Ember command error: "Cannot find module 'strip-ansi'"

Everything works perfectly in my development environment but when I go to my production server ember command is not working and is returning always the same error:

$ node_modules/.bin/ember
Cannot find module 'strip-ansi'
Error: Cannot find module 'strip-ansi'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/var/www/reportsdashboardclient.daliaresearch.com/shared/node_modules/chalk/index.js:4:17)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)

I have tried:

$ bower cache clean
$ bower install --force
$ bower prune

Doesn’t work

$ rm -rf ~/.npm/
$ npm cache clear
$ npm install --force

Doesn’t work

$ npm install ember --force

Doesn’t work

$ bower -v
1.7.7
$ npm -v
3.3.6
$ node_modules/.bin/ember -v
Cannot find module 'strip-ansi'
Error: Cannot find module 'strip-ansi'

It was working before… and it is working in another server with similar configuration…

Any suggestion of how to fix this?

I don’t know which of these operations made the fix but now is working:

  • Updating npm to “3.7.1”
  • removing all node_modules and install them again with $ npm install

I made a lot of different try an errors in the middle, but I lost trace of them, so I can’t make a proper list.

My recommendation is that when this weird errors happen try to remove upgrade npm and node and bower and remove all modules and cache and reinstall all of them again.

1 Like