Error: Cannot find module 'commander'

25,001

Solution 1

Uninstalling sails and reinstalling with 'sudo' resolved it.

npm uninstall sails -g

sudo npm install sails -g

Solution 2

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

npm install commander --save

Solution 3

Install commander globally.

sudo npm install commander -g

  • This will install commander module under/usr/lib/node_modules/.

Solution 4

When i try setup new app with the help of express-generator. given error:Cannot find module 'commander'

Node version:12.16.1
switch node version :10.16.3

after switch node version is working fine..

Share:
25,001
Don
Author by

Don

Updated on July 09, 2022

Comments

  • Don
    Don almost 2 years

    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)
    
  • Soren
    Soren over 5 years
    This did not fix it for me.