Reputation: 630
When I install any npm pakages such as: npm i lodash, npm i bcrypt, etc..., it errors like this:
Error: Cannot find module '../lib/utils/unsupported.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:19:21
at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:153:3)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
internal/modules/cjs/loader.js:582
throw err;
Upvotes: 2
Views: 5121
Reputation: 5811
Version of the accepted answer adapted to OSX:
rm -rf /usr/local/lib/node_modules
brew reinstall node
Upvotes: 3
Reputation: 630
Try this
Upvotes: 1
Reputation: 1982
Try removing the folder %USERPROFILE%\AppData\Roaming\npm\
and using your commands again. You may need to reinstall node.
Upvotes: 1