Node: npm installation broken

Created on 30 Mar 2018  路  4Comments  路  Source: nodejs/node

I'm not sure when this fell apart, but I'm experiencing this:

````$ npm -v
module.js:545
throw err;
^

Error: Cannot find module '../lib/utils/unsupported.js'
at Function.Module._resolveFilename (module.js:543:15)
at Function.Module._load (module.js:470:25)
at Module.require (module.js:593:17)
at require (internal/module.js:11:18)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
at Object. (/usr/local/lib/node_modules/npm/bin/npm-cli.js:92:3)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
````
I tried updating, then uninstalling, then re-installing node with homebrew.

$ uname -a Darwin Ricos-MacBook-Pro.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jan 11 22:59:40 PST 2018; root:xnu-3789.73.8~1/RELEASE_X86_64 x86_64

Does anyone know how to troubleshoot this?

npm

Most helpful comment

I finally got this fixed:

  • brew uninstall node

  • manual rm of the npm binary which was lingering

Then did the following:

$ sudo chown -R $USER /usr/local
$ brew postinstall node

npm now finally works!

All 4 comments

Could you also try to post the issue to the npm repository?

Will do! Thanks @vsemozhetbyt

I finally got this fixed:

  • brew uninstall node

  • manual rm of the npm binary which was lingering

Then did the following:

$ sudo chown -R $USER /usr/local
$ brew postinstall node

npm now finally works!

Was this page helpful?
0 / 5 - 0 ratings