How can I solve this error when using `npm` or `update50` in the terminal


~/workspace/ $ npm
    throw err;

Error: Cannot find module 'semver'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/ubuntu/.nvm/versions/node/v7.6.0/lib/node_modules/npm/lib/utils/unsupported.js:2:14)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
~/workspace/ $ 

I’ve tried a lot of solutions but still have this problem.
any help, please.


seems like your npm is broken.
Try reinstalling node

nvm uninstall 7.6.0;  nvm install 7.6.0