3

I am on Mac OS X Lion, I just used the package installer from nodejs.org to install node.js. Node.js is working fine, and Node.js comes with npm. I have homebrew installed as well. I am just trying to install coffeescript, but the terminal keeps throwing an error. So i decieded to check what version of npm I am running. It just keeps throwing an error. Whenever i try to use any npm command, it throws the same error. I tried to just install npm seperately and I get and error, and same thing when i try to remove npm. Can anyone please help, this is so unbelievably frustrating.

Error when i call npm help

macbook-air:~ mcbeav$ sudo npm help

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: No such module
    at Object.<anonymous> (/usr/lib/node_modules/npm/lib/utils/config-defs.js:5:21)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Module.require (module.js:354:17)
    at require (module.js:370:17)
    at Object.<anonymous> (/usr/lib/node_modules/npm/lib/utils/ini.js:43:18)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
macbook-air:~ mcbeav$ 

error when i try to install npm through the terminal

All clean!

npm ERR! Error: EPERM, chmod '/usr/local/bin/npm'
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.
npm ERR! 
npm ERR! System Darwin 11.3.0
npm ERR! command "/usr/local/bin/node" "/private/var/folders/g1/tn_gpxcj423d1dn_jx2g9gp40000gn/T/npm.1064/package/cli.js" "rm" "npm" "-gf"
npm ERR! cwd /private/var/folders/g1/tn_gpxcj423d1dn_jx2g9gp40000gn/T/npm.1064/package
npm ERR! node -v v0.6.17
npm ERR! npm -v 1.1.21
npm ERR! path /usr/local/bin/npm
npm ERR! code EPERM
npm ERR! message EPERM, chmod '/usr/local/bin/npm'
npm ERR! errno {}
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /private/var/folders/g1/tn_gpxcj423d1dn_jx2g9gp40000gn/T/npm.1064/package/npm-debug.log
npm not ok
npm ERR! error rolling back npm@1.1.21 Error: EPERM, chmod '/usr/local/bin/npm'

npm ERR! Error: EPERM, chmod '/usr/local/bin/npm'
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.
npm ERR! 
npm ERR! System Darwin 11.3.0
npm ERR! command "/usr/local/bin/node" "/private/var/folders/g1/tn_gpxcj423d1dn_jx2g9gp40000gn/T/npm.1064/package/cli.js" "install" "-gf"
npm ERR! cwd /private/var/folders/g1/tn_gpxcj423d1dn_jx2g9gp40000gn/T/npm.1064/package
npm ERR! node -v v0.6.17
npm ERR! npm -v 1.1.21
npm ERR! path /usr/local/bin/npm
npm ERR! code EPERM
npm ERR! message EPERM, chmod '/usr/local/bin/npm'
npm ERR! errno {}
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /private/var/folders/g1/tn_gpxcj423d1dn_jx2g9gp40000gn/T/npm.1064/package/npm-debug.log
npm not ok
It failed
macbook-air:~ mcbeav$ 

Error when i try to remove npm

macbook-air:~ mcbeav$ sudo npm uninstall npm -g

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
    Error: No such module
        at Object.<anonymous> (/usr/lib/node_modules/npm/lib/utils/config-defs.js:5:21)
        at Module._compile (module.js:441:26)
        at Object..js (module.js:459:10)
        at Module.load (module.js:348:31)
        at Function._load (module.js:308:12)
        at Module.require (module.js:354:17)
        at require (module.js:370:17)
        at Object.<anonymous> (/usr/lib/node_modules/npm/lib/utils/ini.js:43:18)
        at Module._compile (module.js:441:26)
        at Object..js (module.js:459:10)
    macbook-air:~ mcbeav$ 
10

It turns out an old installation was conflicting with the new one. The old was stored in

usr/bin

where the new was stored in

usr/local/bin

i had to install it using the command

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

and it worked fine, for anyone else having the same issue, very frustrating

1
  • The repository has been moved permanently. Try to use the "-L" flag on curl to follow the redirect: 'curl -L npmjs.org/install.sh | sudo clean=yes sh' – david Sep 13 '16 at 18:14
1

Error: EPERM, chmod '/usr/local/bin/npm' is a permissions error. Most likely, the permissions on /usr/local/bin/npm' are incorrect (perhaps not executable?), or it is missing.

You could try installing the previous version of node.js. This might also help vett the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.