Node.js on Mac OS X npm "Error: no such module"

I installed node.js v0.8.8 from the pkg installer and compiled from the source. However, I get the following error when trying to start npm. Any help would be appreciated.

> $ npm --help > > /usr/lib/node_modules/npm/lib/utils/config-defs.js:5 , stdio = > process.binding("stdio") > ^ Error: No such module > at Object.<anonymous> (/usr/lib/node_modules/npm/lib/utils/config-defs.js:5:21) > at Module._compile (module.js:449:26) > at Object.Module._extensions..js (module.js:467:10) > at Module.load (module.js:356:32) > at Function.Module._load (module.js:312:12) > at Module.require (module.js:362:17) > at require (module.js:378:17) > at Object.<anonymous> (/usr/lib/node_modules/npm/lib/utils/ini.js:43:18) > at Module._compile (module.js:449:26) > at Object.Module._extensions..js (module.js:467:10) 
+5
source share
2 answers

Most likely you are using an old version of NPM. see npm issue

+3
source

I had the same issue upgrade from Node.JS 0.4 to 0.8. What worked for me:

The OSX package installer Node.JS mistakenly does not remove the old installation with the number 0.4 n / min in / usr / bin, which then conflicts with the new 0.8 in / usr / local / bin. He just overwrites everything that is already there. I destroyed the old one by deleting it, but to make sure, I decided that a clean installation would be better:

curl https://npmjs.org/install.sh | sudo clean=yes sh

There was one last problem: after installation, although which npm correctly returns /usr/local/bin/npm , bash tried to execute from / usr / bin. This is because in OSX, bash hashes an executable name. Hashing keeps re-searching all directories in your PATH every time you run shared programs. A hash -r on the command line took care of this problem.

+9
source

Source: https://habr.com/ru/post/924366/


All Articles