Error: Cannot find module 'commander'

Don picture Don · Mar 20, 2018 · Viewed 17.2k times · Source

when I m running sails -v, sails lift or even installing npm I m getting this error Please help -

Error: Cannot find module 'commander'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/sails/bin/_commander.js:6:15)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)

Answer

ralphtheninja picture ralphtheninja · Mar 20, 2018

Most likely commander is missing from package.json. Install it and add it to package.json by doing:

npm install commander --save