Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.

Run the following commands to remove all existing global npm modules, uninstall node & npm, re-install node with the correct defaults, configure the location for global npm modules to be installed, and then install npm as its own pacakge.

rm -rf /usr/local/lib/node_modules
brew uninstall node
brew install node --without-npm
echo prefix=~/.npm-packages >> ~/.npmrc
curl -L https://www.npmjs.com/install.sh | sh

Node and npm should be correctly installed at this point. The final step is to add ~/.npm-packages/bin to your PATH so npm and global npm packages are usable. To do this, add the following line to your ~/.bash_profile:

export PATH="$HOME/.npm-packages/bin:$PATH"

Now you can re-install any global npm packages you need without any problems.

Explanation of the issue

If you're a Homebrew user and you installed node via Homebrew, there is a major philosophical issue with the way Homebrew and NPM work together. If you install node with Homebrew and then try to do npm update npm -g, you may see an error like this:

$ npm update npm -g
npm http GET https://registry.npmjs.org/npm
npm http 304 https://registry.npmjs.org/npm
npm http GET https://registry.npmjs.org/npm/1.4.4
npm http 304 https://registry.npmjs.org/npm/1.4.4
npm ERR! error rolling back Error: Refusing to delete: /usr/local/bin/npm not in /usr/local/lib/node_modules/npm
npm ERR! error rolling back     at clobberFail (/usr/local/Cellar/node/0.10.26/lib/node_modules/npm/lib/utils/gently-rm.js:57:12)
npm ERR! error rolling back     at next (/usr/local/Cellar/node/0.10.26/lib/node_modules/npm/lib/utils/gently-rm.js:43:14)
npm ERR! error rolling back     at /usr/local/Cellar/node/0.10.26/lib/node_modules/npm/lib/utils/gently-rm.js:52:12
npm ERR! error rolling back     at Object.oncomplete (fs.js:107:15)
npm ERR! error rolling back  npm@1.4.4 { [Error: Refusing to delete: /usr/local/bin/npm not in /usr/local/lib/node_modules/npm] code: 'EEXIST', path: '/usr/local/bin/npm' }
npm ERR! Refusing to delete: /usr/local/bin/npm not in /usr/local/lib/node_modules/npm
File exists: /usr/local/bin/npm
Move it away, and try again. 

npm ERR! System Darwin 13.1.0
npm ERR! command "/usr/local/Cellar/node/0.10.26/bin/node" "/usr/local/bin/npm" "update" "npm" "-g"
npm ERR! cwd /Users/dan/Google Drive/Projects/dotfiles
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! path /usr/local/bin/npm
npm ERR! code EEXIST
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/dan/Google Drive/Projects/dotfiles/npm-debug.log
npm ERR! not ok code 0

There's an NPM bug for this exact problem. The bug has been "fixed" by Homebrew installing npm in a way that allows it to manage itself once the install is complete. However, this is error-prone and still seems to cause problems for some people. The root of the the issue is really that npm is its own package manager and it is therefore better to have npm manage itself and its packages completely on its own instead of letting Homebrew do it.

Also, using the Homebrew installation of npm will require you to use sudo when installing global packages. Since one of the core ideas behind Homebrew is that apps can be installed without giving them root access, this is a bad idea.

@dbaq

This comment has been minimized.

Show comment Hide comment
@dbaq

dbaq Apr 17, 2014

Thanks! πŸ‘

dbaq commented Apr 17, 2014

Thanks! πŸ‘

@martypitt

This comment has been minimized.

Show comment Hide comment
@martypitt

martypitt Apr 20, 2014

Outstanding! πŸ‘

Outstanding! πŸ‘

@semikolon

This comment has been minimized.

Show comment Hide comment
@semikolon

semikolon Sep 19, 2014

I got these error messages, but it seems to have worked...

Fredriks-MacBook-Pro% curl -L https://www.npmjs.org/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6711 100 6711 0 0 8838 0 --:--:-- --:--:-- --:--:-- 8830
tar=/usr/bin/tar
version:
bsdtar 2.8.3 - libarchive 2.8.3
install npm@latest
fetching: http://registry.npmjs.org/npm/-/npm-2.0.0.tgz

/private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/bin/read-package-json.js:18
val = val[f]
^
TypeError: Cannot read property 'node' of undefined
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/bin/read-package-json.js:18:16
at Array.forEach (native)
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/bin/read-package-json.js:17:11
at Array.forEach (native)
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/bin/read-package-json.js:14:22
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/node_modules/read-package-json/read-json.js:51:40
at final (/private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/node_modules/read-package-json/read-json.js:349:17)
at then (/private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/node_modules/read-package-json/read-json.js:126:33)
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/node_modules/read-package-json/read-json.js:266:40
at evalmachine.:271:14
0.10.31

/private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/bin/read-package-json.js:18
val = val[f]
^
TypeError: Cannot read property 'node' of undefined
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/bin/read-package-json.js:18:16
at Array.forEach (native)
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/bin/read-package-json.js:17:11
at Array.forEach (native)
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/bin/read-package-json.js:14:22
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/node_modules/read-package-json/read-json.js:51:40
at final (/private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/node_modules/read-package-json/read-json.js:349:17)
at then (/private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/node_modules/read-package-json/read-json.js:126:33)
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/node_modules/read-package-json/read-json.js:266:40
at evalmachine.:271:14

npm@2.0.0 prepublish /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package
node bin/npm-cli.js prune --prefix=. --no-global && rm -rf test///node_modules && make -j8 doc

make: Nothing to be done for `doc'.
/Users/fredrikbranstrom/.node/bin/npm -> /Users/fredrikbranstrom/.node/lib/node_modules/npm/bin/npm-cli.js
npm@2.0.0 /Users/fredrikbranstrom/.node/lib/node_modules/npm
It worked
Fredriks-MacBook-Pro%

I got these error messages, but it seems to have worked...

Fredriks-MacBook-Pro% curl -L https://www.npmjs.org/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6711 100 6711 0 0 8838 0 --:--:-- --:--:-- --:--:-- 8830
tar=/usr/bin/tar
version:
bsdtar 2.8.3 - libarchive 2.8.3
install npm@latest
fetching: http://registry.npmjs.org/npm/-/npm-2.0.0.tgz

/private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/bin/read-package-json.js:18
val = val[f]
^
TypeError: Cannot read property 'node' of undefined
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/bin/read-package-json.js:18:16
at Array.forEach (native)
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/bin/read-package-json.js:17:11
at Array.forEach (native)
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/bin/read-package-json.js:14:22
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/node_modules/read-package-json/read-json.js:51:40
at final (/private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/node_modules/read-package-json/read-json.js:349:17)
at then (/private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/node_modules/read-package-json/read-json.js:126:33)
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/node_modules/read-package-json/read-json.js:266:40
at evalmachine.:271:14
0.10.31

/private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/bin/read-package-json.js:18
val = val[f]
^
TypeError: Cannot read property 'node' of undefined
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/bin/read-package-json.js:18:16
at Array.forEach (native)
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/bin/read-package-json.js:17:11
at Array.forEach (native)
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/bin/read-package-json.js:14:22
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/node_modules/read-package-json/read-json.js:51:40
at final (/private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/node_modules/read-package-json/read-json.js:349:17)
at then (/private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/node_modules/read-package-json/read-json.js:126:33)
at /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package/node_modules/read-package-json/read-json.js:266:40
at evalmachine.:271:14

npm@2.0.0 prepublish /private/var/folders/qs/8nmw36_11t727ckk5npwv81w0000gn/T/npm.29023/package
node bin/npm-cli.js prune --prefix=. --no-global && rm -rf test///node_modules && make -j8 doc

make: Nothing to be done for `doc'.
/Users/fredrikbranstrom/.node/bin/npm -> /Users/fredrikbranstrom/.node/lib/node_modules/npm/bin/npm-cli.js
npm@2.0.0 /Users/fredrikbranstrom/.node/lib/node_modules/npm
It worked
Fredriks-MacBook-Pro%

@SteveBenner

This comment has been minimized.

Show comment Hide comment
@SteveBenner

SteveBenner Sep 23, 2014

This solution works for me, although it does make me sad that I can’t use Homebrew. I’ve no idea what’s going on underneath the hood, as I’m primarily a Ruby guy. Two strange things jump out at me:

  1. Though ~/.node/bin is on my path, (and not being overridden) I cannot find any of the executables inside using the which -a command… They nonetheless are fully functional.
  2. When I run npm update -g it appears to work as expected, but the following error message shows on completion:
npm ERR! Darwin 13.3.0
npm ERR! argv "node" "/Users/user/.node/bin/npm" "update" "-g"
npm ERR! node v0.10.32
npm ERR! npm  v2.0.0
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package npmconf does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer npm-registry-client@3.2.2 wants npmconf@^2.1.0

I surmised the problem may be npmconf, and perhaps it’s related to this recently opened issue.

This solution works for me, although it does make me sad that I can’t use Homebrew. I’ve no idea what’s going on underneath the hood, as I’m primarily a Ruby guy. Two strange things jump out at me:

  1. Though ~/.node/bin is on my path, (and not being overridden) I cannot find any of the executables inside using the which -a command… They nonetheless are fully functional.
  2. When I run npm update -g it appears to work as expected, but the following error message shows on completion:
npm ERR! Darwin 13.3.0
npm ERR! argv "node" "/Users/user/.node/bin/npm" "update" "-g"
npm ERR! node v0.10.32
npm ERR! npm  v2.0.0
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package npmconf does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer npm-registry-client@3.2.2 wants npmconf@^2.1.0

I surmised the problem may be npmconf, and perhaps it’s related to this recently opened issue.

@Martinspire

This comment has been minimized.

Show comment Hide comment
@Martinspire

Martinspire Oct 1, 2014

Isn't it better to just uninstall node via homebrew and use the installer from nodejs.org? Separating them also seems a bit odd

Isn't it better to just uninstall node via homebrew and use the installer from nodejs.org? Separating them also seems a bit odd

@paul-ylz

This comment has been minimized.

Show comment Hide comment
@paul-ylz

paul-ylz Oct 12, 2014

Thanks this helped me fix my npm issues

Thanks this helped me fix my npm issues

@tomhanlon

This comment has been minimized.

Show comment Hide comment
@tomhanlon

tomhanlon Oct 15, 2014

Huge help. Thanks.

Huge help. Thanks.

@captDaylight

This comment has been minimized.

Show comment Hide comment
@captDaylight

captDaylight Oct 16, 2014

Wow, been looking for this solution for a full day. Thanks for posting, great stuff.

Wow, been looking for this solution for a full day. Thanks for posting, great stuff.

@robbennet

This comment has been minimized.

Show comment Hide comment
@robbennet

robbennet Oct 20, 2014

SO much this! Extremely helpful.

SO much this! Extremely helpful.

@tgrecojs

This comment has been minimized.

Show comment Hide comment
@tgrecojs

tgrecojs Oct 24, 2014

Thank you!

Thank you!

@bingalls

This comment has been minimized.

Show comment Hide comment
@bingalls

bingalls Oct 28, 2014

Please add this step, before deleting /usr/local/node_modules (to not lose all your work):
ls -1 /usr/local/node_modules > ~/node_modules.txt
at the end, do:
for i in cat ~/node_modules.txt;do npm install -g $i;done

Hopefully, it is not necessary to track module versions or the new private npm modules.

Please add this step, before deleting /usr/local/node_modules (to not lose all your work):
ls -1 /usr/local/node_modules > ~/node_modules.txt
at the end, do:
for i in cat ~/node_modules.txt;do npm install -g $i;done

Hopefully, it is not necessary to track module versions or the new private npm modules.

@espiler

This comment has been minimized.

Show comment Hide comment
@espiler

espiler Nov 3, 2014

Thanks a ton!

espiler commented Nov 3, 2014

Thanks a ton!

@cmezian

This comment has been minimized.

Show comment Hide comment
@cmezian

cmezian Nov 10, 2014

Worked like a charm for my older iMac, thank you!

cmezian commented Nov 10, 2014

Worked like a charm for my older iMac, thank you!

@GrimmOutlook

This comment has been minimized.

Show comment Hide comment
@GrimmOutlook

GrimmOutlook Nov 16, 2014

Until I typed in "npm install -g blah, blah, blah", everything worked. Once I tried to re-install some global node modules, I get: "bash: /usr/local/bin/npm: No such file or directory". Anyone else run into this? Any thoughts? Seems like it can be fixed by something simple. Thanks!

Until I typed in "npm install -g blah, blah, blah", everything worked. Once I tried to re-install some global node modules, I get: "bash: /usr/local/bin/npm: No such file or directory". Anyone else run into this? Any thoughts? Seems like it can be fixed by something simple. Thanks!

@gavstah

This comment has been minimized.

Show comment Hide comment
@gavstah

gavstah Nov 25, 2014

This worked a treat for me. Up until now, I'd been struggling to get node & npm going on my mac.

@GrimmOutlook - judging by the output, it seems like npm's looking in the wrong place - did you add ~/.npm/bin to your path and then run:

source ~/.bash_profile

to load the path change?

gavstah commented Nov 25, 2014

This worked a treat for me. Up until now, I'd been struggling to get node & npm going on my mac.

@GrimmOutlook - judging by the output, it seems like npm's looking in the wrong place - did you add ~/.npm/bin to your path and then run:

source ~/.bash_profile

to load the path change?

@pelachile

This comment has been minimized.

Show comment Hide comment
@pelachile

pelachile Nov 28, 2014

Hmm. Now none of my newly installed global commands are found. In fact a node_modules folder isn't created in my home directory. All modules are being installed into /usr/local/bin/ which is already in my path.

Hmm. Now none of my newly installed global commands are found. In fact a node_modules folder isn't created in my home directory. All modules are being installed into /usr/local/bin/ which is already in my path.

@unostella

This comment has been minimized.

Show comment Hide comment
@unostella

unostella Nov 30, 2014

Thanks for this, it all worked great up to the point when I re-open terminal, just like @GrimmOutlook described.
So after restarting terminal it says -bash: npm: command not found
So I have to export PATH="$HOME/.node/bin:$PATH" each time I open it up.
Any idea how to fix that?

Thanks for this, it all worked great up to the point when I re-open terminal, just like @GrimmOutlook described.
So after restarting terminal it says -bash: npm: command not found
So I have to export PATH="$HOME/.node/bin:$PATH" each time I open it up.
Any idea how to fix that?

@merraysy

This comment has been minimized.

Show comment Hide comment
@merraysy

merraysy Dec 15, 2014

thanks your are the πŸ‘¨

thanks your are the πŸ‘¨

@brockthebear

This comment has been minimized.

Show comment Hide comment
@brockthebear

brockthebear Dec 24, 2014

Incredibly helpful. Thanks so much.

Incredibly helpful. Thanks so much.

@aljopro

This comment has been minimized.

Show comment Hide comment
@aljopro

aljopro Dec 28, 2014

@unostella, I had to put the export ~/.profile instead of ~/.path

aljopro commented Dec 28, 2014

@unostella, I had to put the export ~/.profile instead of ~/.path

@johannyberg

This comment has been minimized.

Show comment Hide comment
@johannyberg

johannyberg Dec 31, 2014

Thank you!

Thank you!

@kaishin

This comment has been minimized.

Show comment Hide comment
@kaishin

kaishin Dec 31, 2014

This worked great, thanks!

kaishin commented Dec 31, 2014

This worked great, thanks!

@watsy0007

This comment has been minimized.

Show comment Hide comment
@watsy0007

watsy0007 Jan 3, 2015

thank you!

thank you!

@chenrui333

This comment has been minimized.

Show comment Hide comment
@chenrui333

chenrui333 Jan 4, 2015

node 0.10.26 is still installed.
Remove them all with brew uninstall --force node.

node 0.10.26 is still installed.
Remove them all with brew uninstall --force node.

@chenrui333

This comment has been minimized.

Show comment Hide comment
@chenrui333

chenrui333 Jan 4, 2015

Also, "npm cache clear" is good for testing the cmd as well.

Thanks for the gist!

Also, "npm cache clear" is good for testing the cmd as well.

Thanks for the gist!

@phudekar

This comment has been minimized.

Show comment Hide comment
@phudekar

phudekar Jan 6, 2015

Thanks. You saved my day

phudekar commented Jan 6, 2015

Thanks. You saved my day

@morganloehr

This comment has been minimized.

Show comment Hide comment
@morganloehr

morganloehr Jan 9, 2015

Serious thanks for this!

Serious thanks for this!

@favorit

This comment has been minimized.

Show comment Hide comment
@favorit

favorit Jan 20, 2015

Thank you! It works for me!

favorit commented Jan 20, 2015

Thank you! It works for me!

@philbritton

This comment has been minimized.

Show comment Hide comment
@philbritton

philbritton Jan 20, 2015

awesome, i'm back in business, thanks!

awesome, i'm back in business, thanks!

This comment has been minimized.

Show comment Hide comment
@ghost

ghost Jan 24, 2015

Thankyou so much!

ghost commented Jan 24, 2015

Thankyou so much!

@dan-mckay

This comment has been minimized.

Show comment Hide comment
@dan-mckay

dan-mckay Jan 26, 2015

More thanks from me, too ;)

More thanks from me, too ;)

@joshuakemp1

This comment has been minimized.

Show comment Hide comment
@joshuakemp1

joshuakemp1 Jan 27, 2015

THANKS!!

THANKS!!

@prokizzle

This comment has been minimized.

Show comment Hide comment
@prokizzle

prokizzle Feb 2, 2015

Thank you so very much!

Thank you so very much!

@fa3

This comment has been minimized.

Show comment Hide comment
@fa3

fa3 Feb 3, 2015

What can i say instead Thank you? Ha, thank you very much!

fa3 commented Feb 3, 2015

What can i say instead Thank you? Ha, thank you very much!

@NandoSantana

This comment has been minimized.

Show comment Hide comment
@NandoSantana

NandoSantana Feb 8, 2015

hi, printed error: /usr/local/bin/npm: No such file or directory , help me.

hi, printed error: /usr/local/bin/npm: No such file or directory , help me.

@pedrocatre

This comment has been minimized.

Show comment Hide comment
@pedrocatre

pedrocatre Feb 9, 2015

Thank you so much!

Thank you so much!

@guimap

This comment has been minimized.

Show comment Hide comment
@guimap

guimap Feb 11, 2015

Thanksss man, u save my life, thanks thanks....

guimap commented Feb 11, 2015

Thanksss man, u save my life, thanks thanks....

@thechrisproject

This comment has been minimized.

Show comment Hide comment
@thechrisproject

thechrisproject Feb 13, 2015

Dang, I tried these instructions and everything worked well until running the script:

$ curl -L https://www.npmjs.org/install.sh | sh % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 51 100 51 0 0 124 0 --:--:-- --:--:-- --:--:-- 124 100 6239 100 6239 0 0 8293 0 --:--:-- --:--:-- --:--:-- 23022 sh: line 21: npm-install-36841.sh: Permission denied rm: npm-install-36841.sh: No such file or directory Failed to download script

Dang, I tried these instructions and everything worked well until running the script:

$ curl -L https://www.npmjs.org/install.sh | sh % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 51 100 51 0 0 124 0 --:--:-- --:--:-- --:--:-- 124 100 6239 100 6239 0 0 8293 0 --:--:-- --:--:-- --:--:-- 23022 sh: line 21: npm-install-36841.sh: Permission denied rm: npm-install-36841.sh: No such file or directory Failed to download script

@mnlsn

This comment has been minimized.

Show comment Hide comment
@mnlsn

mnlsn Feb 15, 2015

use curl -L https://www.npmjs.com/install.sh | sh if you get the Permission Denied error when installing npm

mnlsn commented Feb 15, 2015

use curl -L https://www.npmjs.com/install.sh | sh if you get the Permission Denied error when installing npm

@rowild

This comment has been minimized.

Show comment Hide comment
@rowild

rowild Feb 19, 2015

I got an error on Mac Maverick 10.9.5, because I use MAMP, which elivers its own libtool. I could solve this problem by creating a symlink from the MAMP version to the bin version

// create backup of MAMP libtool
mv /Applications/MAMP/bin/libtool /Applications/MAMP/bin/libtool_orig

// create symlink
ln -s /usr/bin/libtool /Applications/MAMP/bin/libtool

// then install node

Just in case somebody got the same error...

Thanks for your solution!!!

rowild commented Feb 19, 2015

I got an error on Mac Maverick 10.9.5, because I use MAMP, which elivers its own libtool. I could solve this problem by creating a symlink from the MAMP version to the bin version

// create backup of MAMP libtool
mv /Applications/MAMP/bin/libtool /Applications/MAMP/bin/libtool_orig

// create symlink
ln -s /usr/bin/libtool /Applications/MAMP/bin/libtool

// then install node

Just in case somebody got the same error...

Thanks for your solution!!!

@yonatann

This comment has been minimized.

Show comment Hide comment
@yonatann

yonatann Feb 20, 2015

Worked like a charm!

Worked like a charm!

@jinyoungc

This comment has been minimized.

Show comment Hide comment
@jinyoungc

jinyoungc Feb 21, 2015

OMG THANK YOU!!!!!!

OMG THANK YOU!!!!!!

@jserrao

This comment has been minimized.

Show comment Hide comment
@jserrao

jserrao Feb 23, 2015

FYI: 'curl -L https://www.npmjs.org/install.sh | sh' returns a 404 for me. Just drop the https to http and things worked swimmingly. Thanks for digging into this issue. I've long had conflicts similar to those noted in your post and this resolved a great many of them.

jserrao commented Feb 23, 2015

FYI: 'curl -L https://www.npmjs.org/install.sh | sh' returns a 404 for me. Just drop the https to http and things worked swimmingly. Thanks for digging into this issue. I've long had conflicts similar to those noted in your post and this resolved a great many of them.

@irealva

This comment has been minimized.

Show comment Hide comment
@irealva

irealva Feb 24, 2015

Awesome, this helped a lot. I first ran:

$ brew doctor

and fixed all the node related warning. Then followed your instructions and it worked like a charm.

This page helped too: http://forums.webhook.com/t/cant-get-node-to-install-on-latest-osx-mavericks-resolved/109/5

irealva commented Feb 24, 2015

Awesome, this helped a lot. I first ran:

$ brew doctor

and fixed all the node related warning. Then followed your instructions and it worked like a charm.

This page helped too: http://forums.webhook.com/t/cant-get-node-to-install-on-latest-osx-mavericks-resolved/109/5

@reesejohn69

This comment has been minimized.

Show comment Hide comment
@reesejohn69

reesejohn69 Mar 10, 2015

If I use brew install node --without-npm command to isntall node, what's gonna happen when node gets updated via homebrew? Will that install npm?

If I use brew install node --without-npm command to isntall node, what's gonna happen when node gets updated via homebrew? Will that install npm?

@benpolinsky

This comment has been minimized.

Show comment Hide comment
@benpolinsky

benpolinsky Mar 10, 2015

Thanks so much.

Thanks so much.

@dnlserrano

This comment has been minimized.

Show comment Hide comment
@dnlserrano

dnlserrano Mar 13, 2015

Thanks! You're the man! πŸ‘‘

Thanks! You're the man! πŸ‘‘

@rebekahkwon

This comment has been minimized.

Show comment Hide comment
@rebekahkwon

rebekahkwon Mar 13, 2015

πŸ‘ thank you!

πŸ‘ thank you!

@reiaguilera

This comment has been minimized.

Show comment Hide comment
@reiaguilera

reiaguilera Mar 19, 2015

Excelent ! (Y)

Excelent ! (Y)

@guoylyy

This comment has been minimized.

Show comment Hide comment
@guoylyy

guoylyy Mar 27, 2015

Excelent! Thanks a lot.

guoylyy commented Mar 27, 2015

Excelent! Thanks a lot.

@mikeymco

This comment has been minimized.

Show comment Hide comment
@mikeymco

mikeymco Mar 27, 2015

Thanks πŸ‘

Thanks πŸ‘

@jklegseth

This comment has been minimized.

Show comment Hide comment
@jklegseth

jklegseth Apr 4, 2015

Thanks! Nothing's ever easy...

Thanks! Nothing's ever easy...

@mitogh

This comment has been minimized.

Show comment Hide comment
@mitogh

mitogh Apr 5, 2015

Thanks, works perfect. πŸ‘

mitogh commented Apr 5, 2015

Thanks, works perfect. πŸ‘

@arnelh

This comment has been minimized.

Show comment Hide comment
@arnelh

arnelh Apr 15, 2015

Thanks

arnelh commented Apr 15, 2015

Thanks

@codykrainock

This comment has been minimized.

Show comment Hide comment
@codykrainock

codykrainock Apr 19, 2015

Thank you!

Thank you!

@JonMasterson

This comment has been minimized.

Show comment Hide comment
@JonMasterson

JonMasterson Apr 19, 2015

Thanks so much!

Thanks so much!

@thedamon

This comment has been minimized.

Show comment Hide comment
@thedamon

thedamon Apr 19, 2015

Awesome to see this! But it's weird. I followed the instructions and added .npm and .node\bin to my zshrc, but I am still getting the access errors. Sumfin not quite right

Awesome to see this! But it's weird. I followed the instructions and added .npm and .node\bin to my zshrc, but I am still getting the access errors. Sumfin not quite right

@mariarivas

This comment has been minimized.

Show comment Hide comment
@mariarivas

mariarivas Apr 20, 2015

Awesome, thanks!

Awesome, thanks!

@zekitow

This comment has been minimized.

Show comment Hide comment
@zekitow

zekitow Apr 24, 2015

Thanks!!!

Cheeers!

zekitow commented Apr 24, 2015

Thanks!!!

Cheeers!

@buk

This comment has been minimized.

Show comment Hide comment
@buk

buk Apr 27, 2015

Thanks!

buk commented Apr 27, 2015

Thanks!

@limichange

This comment has been minimized.

Show comment Hide comment
@limichange

limichange Apr 30, 2015

ThanksO(∩_∩)O!

ThanksO(∩_∩)O!

@alphapilgrim

This comment has been minimized.

Show comment Hide comment
@alphapilgrim

alphapilgrim May 2, 2015

Thanks!!

Thanks!!

@SGD1953

This comment has been minimized.

Show comment Hide comment
@SGD1953

SGD1953 May 5, 2015

Thanks a lot, I got errors when installing npm, doing an additional sudo rm -rf ~/.npm did the trick for me.

SGD1953 commented May 5, 2015

Thanks a lot, I got errors when installing npm, doing an additional sudo rm -rf ~/.npm did the trick for me.

@dillorscroft

This comment has been minimized.

Show comment Hide comment
@dillorscroft

dillorscroft May 8, 2015

I get a strange warning/error but then it proceeds to say "It worked"

curl -L https://www.npmjs.com/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6239 100 6239 0 0 6043 0 0:00:01 0:00:01 --:--:-- 6045
tar=/usr/bin/tar
version:
bsdtar 2.8.3 - libarchive 2.8.3
install npm@latest
fetching: http://registry.npmjs.org/npm/-/npm-2.9.1.tgz

npm@2.9.1 prepublish /private/var/folders/1m/f2btkb_j5ng6bzhmzmm73hc40000gn/T/npm.32190/package
node bin/npm-cli.js prune --prefix=. --no-global && rimraf test///node_modules && make -j4 doc

sh: rimraf: command not found

I get a strange warning/error but then it proceeds to say "It worked"

curl -L https://www.npmjs.com/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6239 100 6239 0 0 6043 0 0:00:01 0:00:01 --:--:-- 6045
tar=/usr/bin/tar
version:
bsdtar 2.8.3 - libarchive 2.8.3
install npm@latest
fetching: http://registry.npmjs.org/npm/-/npm-2.9.1.tgz

npm@2.9.1 prepublish /private/var/folders/1m/f2btkb_j5ng6bzhmzmm73hc40000gn/T/npm.32190/package
node bin/npm-cli.js prune --prefix=. --no-global && rimraf test///node_modules && make -j4 doc

sh: rimraf: command not found

@k7n4n5t3w4rt

This comment has been minimized.

Show comment Hide comment
@k7n4n5t3w4rt

k7n4n5t3w4rt May 10, 2015

Many thanks. Installing npm with Homebrew never seemed to work properly but I never knew why. Now I still don't but have them installed :)

I had to use SGD1953's tip and do "sudo rm -rf ~/.npm" before installing npm. Otherwise this happened.

npm ERR! Darwin 13.4.0
npm ERR! argv "/usr/local/bin/node" "/private/var/folders/_b/g8fdbnmx317_s0dlnp784pbr0000gn/T/npm.33170/package/cli.js" "install" "-gf"
npm ERR! node v0.12.2
npm ERR! npm v2.9.1

npm ERR! Attempt to unlock /Users/[MYUSER]/.node/lib/node_modules/npm, which hasn't been locked

Many thanks. Installing npm with Homebrew never seemed to work properly but I never knew why. Now I still don't but have them installed :)

I had to use SGD1953's tip and do "sudo rm -rf ~/.npm" before installing npm. Otherwise this happened.

npm ERR! Darwin 13.4.0
npm ERR! argv "/usr/local/bin/node" "/private/var/folders/_b/g8fdbnmx317_s0dlnp784pbr0000gn/T/npm.33170/package/cli.js" "install" "-gf"
npm ERR! node v0.12.2
npm ERR! npm v2.9.1

npm ERR! Attempt to unlock /Users/[MYUSER]/.node/lib/node_modules/npm, which hasn't been locked

@jovincroninwilesmith

This comment has been minimized.

Show comment Hide comment
@jovincroninwilesmith

jovincroninwilesmith May 10, 2015

@unostella did you ever figure out a fix? I am still getting the same error.

@unostella did you ever figure out a fix? I am still getting the same error.

@sebklaus

This comment has been minimized.

Show comment Hide comment
@sebklaus

sebklaus May 13, 2015

Thank you very much! Works a treat!

Thank you very much! Works a treat!

@azonirunner

This comment has been minimized.

Show comment Hide comment
@azonirunner

azonirunner May 13, 2015

Thank you. Works! Had to add the sudo rm -rf ~/.npm (tip from SGD1953)

Thank you. Works! Had to add the sudo rm -rf ~/.npm (tip from SGD1953)

@sudostack

This comment has been minimized.

Show comment Hide comment
@sudostack

sudostack May 14, 2015

wow! thanks! resolved a totally different error message for me, but awesome! kudos!

wow! thanks! resolved a totally different error message for me, but awesome! kudos!

@deepakmani

This comment has been minimized.

Show comment Hide comment
@deepakmani

deepakmani May 15, 2015

This was very useful when I had to re-install npm .

This was very useful when I had to re-install npm .

@iainwatt

This comment has been minimized.

Show comment Hide comment
@iainwatt

iainwatt May 18, 2015

Ledge!

Ledge!

@0is1

This comment has been minimized.

Show comment Hide comment
@0is1

0is1 May 18, 2015

Yes, thanks! This was really helpful :)

0is1 commented May 18, 2015

Yes, thanks! This was really helpful :)

@aidansmyth

This comment has been minimized.

Show comment Hide comment
@aidansmyth

aidansmyth May 22, 2015

Worked great except for one issue, after running brew install node --without-npm i kept getting
"Could not symlink lib/dtrace/node.d
/usr/local/lib/dtrace is not writable"

I had to run 'sudo chown -R whoami /usr/local' to be able to link brew to node.

Worked great except for one issue, after running brew install node --without-npm i kept getting
"Could not symlink lib/dtrace/node.d
/usr/local/lib/dtrace is not writable"

I had to run 'sudo chown -R whoami /usr/local' to be able to link brew to node.

@anthonybrown

This comment has been minimized.

Show comment Hide comment
@anthonybrown

anthonybrown May 24, 2015

This is funny, I came about the same solution through trial and error and stack overflow.

This is funny, I came about the same solution through trial and error and stack overflow.

This comment has been minimized.

Show comment Hide comment
@ghost

ghost May 28, 2015

Thank you!!!

ghost commented May 28, 2015

Thank you!!!

@ser111

This comment has been minimized.

Show comment Hide comment
@ser111

ser111 May 30, 2015

You're the man.

ser111 commented May 30, 2015

You're the man.

@jonrh

This comment has been minimized.

Show comment Hide comment
@jonrh

jonrh Jun 7, 2015

Awesome, thank you! Following the instructions I ran into some Homebrew issues. Running brew update and then following the instructions again worked.

jonrh commented Jun 7, 2015

Awesome, thank you! Following the instructions I ran into some Homebrew issues. Running brew update and then following the instructions again worked.

@sagic

This comment has been minimized.

Show comment Hide comment
@sagic

sagic Jun 8, 2015

thanks :)

sagic commented Jun 8, 2015

thanks :)

@adaam2

This comment has been minimized.

Show comment Hide comment
@adaam2

adaam2 Jun 12, 2015

This is awesome! great work

adaam2 commented Jun 12, 2015

This is awesome! great work

@jromeem

This comment has been minimized.

Show comment Hide comment
@jromeem

jromeem Jun 14, 2015

this is great!! thanks a butt ton! πŸ‘

jromeem commented Jun 14, 2015

this is great!! thanks a butt ton! πŸ‘

@bghill

This comment has been minimized.

Show comment Hide comment
@bghill

bghill Jun 15, 2015

At some point I must have installed node.js directly. Later I installed via brew. I suspect this is what led my version of node get screwed up file permissions. Out of curiosity, I wanted to see if a "clean" install of node from homebrew would still have the permissions issue. I followed this script: https://gist.github.com/nicerobot/2697848 for most of the uninstall. I also had to remove the ~/.npm and /usr/local/share/systemtap. I only removed the latter after verifying that there was nothing in it related to anything else on my system. With that done, I was able to execute brew install node and the permission issues seem to have disappeared. npm update npm -g now works fine, as does the build process that was giving me trouble.

Let me know if this works for anyone else. I'm curious if most folks just have a long forgotten collision between installs, and complete cleanup is the current solution.

bghill commented Jun 15, 2015

At some point I must have installed node.js directly. Later I installed via brew. I suspect this is what led my version of node get screwed up file permissions. Out of curiosity, I wanted to see if a "clean" install of node from homebrew would still have the permissions issue. I followed this script: https://gist.github.com/nicerobot/2697848 for most of the uninstall. I also had to remove the ~/.npm and /usr/local/share/systemtap. I only removed the latter after verifying that there was nothing in it related to anything else on my system. With that done, I was able to execute brew install node and the permission issues seem to have disappeared. npm update npm -g now works fine, as does the build process that was giving me trouble.

Let me know if this works for anyone else. I'm curious if most folks just have a long forgotten collision between installs, and complete cleanup is the current solution.

@apzentral

This comment has been minimized.

Show comment Hide comment
@apzentral

apzentral Jun 18, 2015

This is awesome. Thank you.

This is awesome. Thank you.

@BenLittle

This comment has been minimized.

Show comment Hide comment
@BenLittle

BenLittle Jun 19, 2015

Excellent. Thank you!

Excellent. Thank you!

@dcondrey

This comment has been minimized.

Show comment Hide comment
@dcondrey

dcondrey Jun 22, 2015


git clone git://github.com/ry/node.git
(cd node && ./configure && make && sudo make install)
chown -R "$USER" /usr/local/{share/man,bin,lib/node,include/node};
npm update npm -g
node -v && npm -v

git clone git://github.com/ry/node.git
(cd node && ./configure && make && sudo make install)
chown -R "$USER" /usr/local/{share/man,bin,lib/node,include/node};
npm update npm -g
node -v && npm -v
@JoeDuncko

This comment has been minimized.

Show comment Hide comment
@JoeDuncko

JoeDuncko Jun 30, 2015

Thanks!

Thanks!

@gbanis

This comment has been minimized.

Show comment Hide comment
@gbanis

gbanis Jul 1, 2015

Worked like a charm. Later I had to remove nvm as well and now everything is in tune. Thank you!

gbanis commented Jul 1, 2015

Worked like a charm. Later I had to remove nvm as well and now everything is in tune. Thank you!

@aking13

This comment has been minimized.

Show comment Hide comment
@aking13

aking13 Jul 2, 2015

You have literally brought so much satisfaction to 3 hours of troubleshooting with so many nodejs, npm, brew problems. Thank you! Thank you!

aking13 commented Jul 2, 2015

You have literally brought so much satisfaction to 3 hours of troubleshooting with so many nodejs, npm, brew problems. Thank you! Thank you!

@dannguyen

This comment has been minimized.

Show comment Hide comment
@dannguyen

dannguyen Jul 4, 2015

The installation process works for me (i.e. it doesn't break) but after installing packages globally, I find that node apparently won't look at the default global path for npm packages. Installing packages locally works just fine.

The installation process works for me (i.e. it doesn't break) but after installing packages globally, I find that node apparently won't look at the default global path for npm packages. Installing packages locally works just fine.

@parsafatehi

This comment has been minimized.

Show comment Hide comment
@parsafatehi

parsafatehi Jul 10, 2015

Thanks, It worked 😊

Thanks, It worked 😊

@RoySegall

This comment has been minimized.

Show comment Hide comment
@RoySegall

RoySegall Jul 11, 2015

Working like a glove!

Working like a glove!

This comment has been minimized.

Show comment Hide comment
@ghost

ghost Jul 13, 2015

Fantastic solution - it sorted my problem with installing react native :) Many thanks

ghost commented Jul 13, 2015

Fantastic solution - it sorted my problem with installing react native :) Many thanks

@chitopolo

This comment has been minimized.

Show comment Hide comment
@chitopolo

chitopolo Jul 14, 2015

Thank you very much, it worked! ;)

Thank you very much, it worked! ;)

@gabrielribeiro

This comment has been minimized.

Show comment Hide comment
@gabrielribeiro

gabrielribeiro Jul 16, 2015

Didn't work for me

Got the following error:

-bash: npm: command not found

My .bash_profile:

[[ -s ~/.bashrc ]] && source ~/.bashrc

My .bashrc:

source dnvm.sh
export MONO_MANAGED_WATCHER=disabled

My .path:

export PATH=/Users/GabrielRibeiro/.node/bin:/Users/GabrielRibeiro/.dnx/runtimes/dnx-mono.1.0.0-b$
export PATH="$HOME/.node/bin:$PATH"

What I did wrong?

Didn't work for me

Got the following error:

-bash: npm: command not found

My .bash_profile:

[[ -s ~/.bashrc ]] && source ~/.bashrc

My .bashrc:

source dnvm.sh
export MONO_MANAGED_WATCHER=disabled

My .path:

export PATH=/Users/GabrielRibeiro/.node/bin:/Users/GabrielRibeiro/.dnx/runtimes/dnx-mono.1.0.0-b$
export PATH="$HOME/.node/bin:$PATH"

What I did wrong?

@qqilihq

This comment has been minimized.

Show comment Hide comment
@qqilihq

qqilihq Jul 24, 2015

Worked like a charm. Thank you!

qqilihq commented Jul 24, 2015

Worked like a charm. Thank you!

@philals

This comment has been minimized.

Show comment Hide comment
@philals

philals Jul 26, 2015

Thanks!

philals commented Jul 26, 2015

Thanks!

@ljhan

This comment has been minimized.

Show comment Hide comment
@ljhan

ljhan Aug 2, 2015

Thank you so much for the help! I still have to export PATH="$HOME/.node/bin:$PATH" each time terminal is re-opened... Could there be a problem with the NODE_PATH?

ljhan commented Aug 2, 2015

Thank you so much for the help! I still have to export PATH="$HOME/.node/bin:$PATH" each time terminal is re-opened... Could there be a problem with the NODE_PATH?

@agostlg

This comment has been minimized.

Show comment Hide comment
@agostlg

agostlg Aug 2, 2015

Thanks!

agostlg commented Aug 2, 2015

Thanks!

@WeHateNick

This comment has been minimized.

Show comment Hide comment
@WeHateNick

WeHateNick Aug 5, 2015

I was able to install node without npm through brew but I get this error when running the curl command:

nick$ curl -L https://www.npmjs.com/install.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6239  100  6239    0     0   8375      0 --:--:-- --:--:-- --:--:--  8374
tar=/usr/bin/tar
version:
bsdtar 2.8.3 - libarchive 2.8.3
install npm@latest
fetching: http://registry.npmjs.org/npm/-/npm-2.13.3.tgz
npm ERR! Darwin 14.3.0
npm ERR! argv "/usr/local/bin/node" "/private/var/folders/hq/2mf0j5sj0c160gl3x33btbmr0000gn/T/npm.4470/package/cli.js" "rm" "npm" "-gf"
npm ERR! node v0.12.7
npm ERR! npm  v2.13.3
npm ERR! path /Users/nick/.node/lib/node_modules/npm/node_modules
npm ERR! code EACCES
npm ERR! errno -13

npm ERR! Error: EACCES, rmdir '/Users/nick/.node/lib/node_modules/npm/node_modules'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES, rmdir '/Users/nick/.node/lib/node_modules/npm/node_modules']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/Users/nick/.node/lib/node_modules/npm/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /private/var/folders/hq/2mf0j5sj0c160gl3x33btbmr0000gn/T/npm.4470/package/npm-debug.log

> npm@2.13.3 prepublish /private/var/folders/hq/2mf0j5sj0c160gl3x33btbmr0000gn/T/npm.4470/package
> node bin/npm-cli.js prune --prefix=. --no-global && rimraf test/*/*/node_modules && make -j4 doc

sh: rimraf: command not found
npm ERR! Darwin 14.3.0
npm ERR! argv "/usr/local/bin/node" "/private/var/folders/hq/2mf0j5sj0c160gl3x33btbmr0000gn/T/npm.4470/package/cli.js" "install" "-gf"
npm ERR! node v0.12.7
npm ERR! npm  v2.13.3
npm ERR! path /Users/nick/.node/lib/node_modules/npm/node_modules
npm ERR! code EACCES
npm ERR! errno -13

npm ERR! Error: EACCES, rmdir '/Users/nick/.node/lib/node_modules/npm/node_modules'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES, rmdir '/Users/nick/.node/lib/node_modules/npm/node_modules']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/Users/nick/.node/lib/node_modules/npm/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EACCES, rmdir '/Users/nick/.node/lib/node_modules/npm/node_modules'
npm ERR! error rolling back     at Error (native)
npm ERR! error rolling back  { [Error: EACCES, rmdir '/Users/nick/.node/lib/node_modules/npm/node_modules']
npm ERR! error rolling back   errno: -13,
npm ERR! error rolling back   code: 'EACCES',
npm ERR! error rolling back   path: '/Users/nick/.node/lib/node_modules/npm/node_modules' }

npm ERR! Please include the following file with any support request:
npm ERR!     /private/var/folders/hq/2mf0j5sj0c160gl3x33btbmr0000gn/T/npm.4470/package/npm-debug.log
It failed

Any ideas?

I was able to install node without npm through brew but I get this error when running the curl command:

nick$ curl -L https://www.npmjs.com/install.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6239  100  6239    0     0   8375      0 --:--:-- --:--:-- --:--:--  8374
tar=/usr/bin/tar
version:
bsdtar 2.8.3 - libarchive 2.8.3
install npm@latest
fetching: http://registry.npmjs.org/npm/-/npm-2.13.3.tgz
npm ERR! Darwin 14.3.0
npm ERR! argv "/usr/local/bin/node" "/private/var/folders/hq/2mf0j5sj0c160gl3x33btbmr0000gn/T/npm.4470/package/cli.js" "rm" "npm" "-gf"
npm ERR! node v0.12.7
npm ERR! npm  v2.13.3
npm ERR! path /Users/nick/.node/lib/node_modules/npm/node_modules
npm ERR! code EACCES
npm ERR! errno -13

npm ERR! Error: EACCES, rmdir '/Users/nick/.node/lib/node_modules/npm/node_modules'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES, rmdir '/Users/nick/.node/lib/node_modules/npm/node_modules']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/Users/nick/.node/lib/node_modules/npm/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /private/var/folders/hq/2mf0j5sj0c160gl3x33btbmr0000gn/T/npm.4470/package/npm-debug.log

> npm@2.13.3 prepublish /private/var/folders/hq/2mf0j5sj0c160gl3x33btbmr0000gn/T/npm.4470/package
> node bin/npm-cli.js prune --prefix=. --no-global && rimraf test/*/*/node_modules && make -j4 doc

sh: rimraf: command not found
npm ERR! Darwin 14.3.0
npm ERR! argv "/usr/local/bin/node" "/private/var/folders/hq/2mf0j5sj0c160gl3x33btbmr0000gn/T/npm.4470/package/cli.js" "install" "-gf"
npm ERR! node v0.12.7
npm ERR! npm  v2.13.3
npm ERR! path /Users/nick/.node/lib/node_modules/npm/node_modules
npm ERR! code EACCES
npm ERR! errno -13

npm ERR! Error: EACCES, rmdir '/Users/nick/.node/lib/node_modules/npm/node_modules'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES, rmdir '/Users/nick/.node/lib/node_modules/npm/node_modules']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/Users/nick/.node/lib/node_modules/npm/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EACCES, rmdir '/Users/nick/.node/lib/node_modules/npm/node_modules'
npm ERR! error rolling back     at Error (native)
npm ERR! error rolling back  { [Error: EACCES, rmdir '/Users/nick/.node/lib/node_modules/npm/node_modules']
npm ERR! error rolling back   errno: -13,
npm ERR! error rolling back   code: 'EACCES',
npm ERR! error rolling back   path: '/Users/nick/.node/lib/node_modules/npm/node_modules' }

npm ERR! Please include the following file with any support request:
npm ERR!     /private/var/folders/hq/2mf0j5sj0c160gl3x33btbmr0000gn/T/npm.4470/package/npm-debug.log
It failed

Any ideas?

@aliwatters

This comment has been minimized.

Show comment Hide comment
@aliwatters

aliwatters Aug 5, 2015

@WeHateNick try $ curl -L https://www.npmjs.com/install.sh | sudo sh

@WeHateNick try $ curl -L https://www.npmjs.com/install.sh | sudo sh

@walterspieler

This comment has been minimized.

Show comment Hide comment
@walterspieler

walterspieler Aug 7, 2015

@ljhan I had the same as you have.
I solved the problem by doing this :
$ touch .bash_profile
$ open .bash_profile
In .bash_profil i added this line
source ~/.bashrc

http://hathaway.cc/post/69201163472/how-to-edit-your-path-environment-variables-on-mac

@ljhan I had the same as you have.
I solved the problem by doing this :
$ touch .bash_profile
$ open .bash_profile
In .bash_profil i added this line
source ~/.bashrc

http://hathaway.cc/post/69201163472/how-to-edit-your-path-environment-variables-on-mac

@Adomeister

This comment has been minimized.

Show comment Hide comment
@Adomeister

Adomeister Aug 12, 2015

THANKYOU @aliwatters this has been bugging me for days!

THANKYOU @aliwatters this has been bugging me for days!

@grantpowell

This comment has been minimized.

Show comment Hide comment
@grantpowell

grantpowell Aug 17, 2015

Cannot install, get error: "npm-install-34536.sh: Permission denied" when attempting "curl -L https://www.npmjs.com/install.sh | sh"

Cannot install, get error: "npm-install-34536.sh: Permission denied" when attempting "curl -L https://www.npmjs.com/install.sh | sh"

@ccheatham

This comment has been minimized.

Show comment Hide comment
@ccheatham

ccheatham Aug 22, 2015

In accordance with what @walterspieler said above if you continue to see this error after you add the source ~/.bashrc it could be because you already have a .node directory in your home directory. I renamed my current .node directory (you could just delete it) then ran it again and it worked. Also you may already have a .profile in which case you can add the source ~/.bashrc to it instead.

In accordance with what @walterspieler said above if you continue to see this error after you add the source ~/.bashrc it could be because you already have a .node directory in your home directory. I renamed my current .node directory (you could just delete it) then ran it again and it worked. Also you may already have a .profile in which case you can add the source ~/.bashrc to it instead.

@alexortiz201

This comment has been minimized.

Show comment Hide comment
@alexortiz201

alexortiz201 Aug 23, 2015

@ljhan you have to add export PATH="$HOME/.node/bin:$PATH" to your ~/.bash_profile or ~/.path file

@ljhan you have to add export PATH="$HOME/.node/bin:$PATH" to your ~/.bash_profile or ~/.path file

@mitchstewart08

This comment has been minimized.

Show comment Hide comment
@mitchstewart08

mitchstewart08 Aug 24, 2015

Thanks a lot!

Thanks a lot!

@jitendravyas

This comment has been minimized.

Show comment Hide comment
@jitendravyas

jitendravyas Aug 26, 2015

@alexortiz201 - I use zsh and ohmyzsh. how to make it work for me

@alexortiz201 - I use zsh and ohmyzsh. how to make it work for me

@mmizutani

This comment has been minimized.

Show comment Hide comment
@mmizutani

mmizutani Aug 30, 2015

In a nutshell:

ls -1 /usr/local/lib/node_modules > ~/node_modules.txt
sed -e "s,/\+$,," -e "s,^/\+,," ~/node_modules.txt
rm -rf /usr/local/lib/node_modules
brew uninstall node --force node
brew install node --without-npm
echo prefix=~/.node >> ~/.npmrc
curl -L https://www.npmjs.com/install.sh | sh
echo 'export PATH="$HOME/.node/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
for i in `cat ~/node_modules.txt`;do npm install -g $i;done
rm ~/node_modules.txt

In a nutshell:

ls -1 /usr/local/lib/node_modules > ~/node_modules.txt
sed -e "s,/\+$,," -e "s,^/\+,," ~/node_modules.txt
rm -rf /usr/local/lib/node_modules
brew uninstall node --force node
brew install node --without-npm
echo prefix=~/.node >> ~/.npmrc
curl -L https://www.npmjs.com/install.sh | sh
echo 'export PATH="$HOME/.node/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
for i in `cat ~/node_modules.txt`;do npm install -g $i;done
rm ~/node_modules.txt
@jordilondoner

This comment has been minimized.

Show comment Hide comment
@jordilondoner

jordilondoner Aug 30, 2015

πŸ‘ all good here, thanks!

πŸ‘ all good here, thanks!

@sadethesage

This comment has been minimized.

Show comment Hide comment
@sadethesage

sadethesage Sep 13, 2015

ilysm, thanks!

ilysm, thanks!

@huijing

This comment has been minimized.

Show comment Hide comment
@huijing

huijing Sep 25, 2015

Following the steps but when I run curl -L https://www.npmjs.com/install.sh | sh I get the following errors:

scripts/installable.sh: line 4: semver: command not found
Packaging or installing npm@3.3.4 with npm@3.3.4 is impossible.
Please install npm@^3.0.0-0 from the registry and use that or run your command with
this version of npm with:
    /usr/local/Cellar/node/4.1.1/bin/node /var/folders/0g/9lxn9c8d3czfj0qvs_qjflxxrn5xph/T/npm.18926/package install -gf
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/Cellar/node/4.1.1/bin/node" "/private/var/folders/0g/9lxn9c8d3czfj0qvs_qjflxxrn5xph/T/npm.18926/package/cli.js" "install" "-gf"
npm ERR! node v4.1.1
npm ERR! npm  v3.3.4

npm ERR! Maximum call stack size exceeded
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /private/var/folders/0g/9lxn9c8d3czfj0qvs_qjflxxrn5xph/T/npm.18926/package/npm-debug.log
It failed

Does this have to do with the latest update to node?

huijing commented Sep 25, 2015

Following the steps but when I run curl -L https://www.npmjs.com/install.sh | sh I get the following errors:

scripts/installable.sh: line 4: semver: command not found
Packaging or installing npm@3.3.4 with npm@3.3.4 is impossible.
Please install npm@^3.0.0-0 from the registry and use that or run your command with
this version of npm with:
    /usr/local/Cellar/node/4.1.1/bin/node /var/folders/0g/9lxn9c8d3czfj0qvs_qjflxxrn5xph/T/npm.18926/package install -gf
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/Cellar/node/4.1.1/bin/node" "/private/var/folders/0g/9lxn9c8d3czfj0qvs_qjflxxrn5xph/T/npm.18926/package/cli.js" "install" "-gf"
npm ERR! node v4.1.1
npm ERR! npm  v3.3.4

npm ERR! Maximum call stack size exceeded
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /private/var/folders/0g/9lxn9c8d3czfj0qvs_qjflxxrn5xph/T/npm.18926/package/npm-debug.log
It failed

Does this have to do with the latest update to node?

@nabeel-ibrahim

This comment has been minimized.

Show comment Hide comment
@nabeel-ibrahim

nabeel-ibrahim Sep 29, 2015

Im getting the same error as @huljing. @huljing did you resolve your issue?

Im getting the same error as @huljing. @huljing did you resolve your issue?

@beastmike

This comment has been minimized.

Show comment Hide comment
@beastmike

beastmike Sep 29, 2015

@jitendravyas - open ~/.zshrc, copy & paste export PATH="$HOME/.npm-packages/bin:$PATH" then save.

beastmike commented Sep 29, 2015

@jitendravyas - open ~/.zshrc, copy & paste export PATH="$HOME/.npm-packages/bin:$PATH" then save.

@rcastag

This comment has been minimized.

Show comment Hide comment
@rcastag

rcastag Oct 2, 2015

Amazeballs!

rcastag commented Oct 2, 2015

Amazeballs!

@fabricioflores

This comment has been minimized.

Show comment Hide comment
@fabricioflores

fabricioflores Oct 3, 2015

I have the same issue as @huijing and @nabeel-ibrahim. Did you find some solution? I thought it was an error of node v4 but I downgraded to v0.12.7 but the issue still persists.
Update
I have noticed that actually there is a version of npm installed. I followed this tutorial and I continued with the next steps after npm install and it works for me.

I have the same issue as @huijing and @nabeel-ibrahim. Did you find some solution? I thought it was an error of node v4 but I downgraded to v0.12.7 but the issue still persists.
Update
I have noticed that actually there is a version of npm installed. I followed this tutorial and I continued with the next steps after npm install and it works for me.

@slemarchand

This comment has been minimized.

Show comment Hide comment
@slemarchand

slemarchand Oct 8, 2015

Great! It Works fine for me!

Great! It Works fine for me!

@skad21

This comment has been minimized.

Show comment Hide comment
@skad21

skad21 Oct 11, 2015

Very helpfull tips...great, thanks !

skad21 commented Oct 11, 2015

Very helpfull tips...great, thanks !

@imechemi

This comment has been minimized.

Show comment Hide comment
@imechemi

imechemi Oct 12, 2015

@huijing first export PATH="$HOME/.node/bin:$PATH" and then cd into your project directory or any directory where package.json file exist. semver is a version tester so you can install it once you have package.json file.

@huijing first export PATH="$HOME/.node/bin:$PATH" and then cd into your project directory or any directory where package.json file exist. semver is a version tester so you can install it once you have package.json file.

@SmellyFish

This comment has been minimized.

Show comment Hide comment
@SmellyFish

SmellyFish Oct 14, 2015

πŸ‘

πŸ‘

@ocaoimh

This comment has been minimized.

Show comment Hide comment
@ocaoimh

ocaoimh Oct 17, 2015

Brilliant. Thanks!

ocaoimh commented Oct 17, 2015

Brilliant. Thanks!

@FredericChang

This comment has been minimized.

Show comment Hide comment
@FredericChang

FredericChang Oct 17, 2015

helpful

helpful

@xinpan1992

This comment has been minimized.

Show comment Hide comment
@xinpan1992

xinpan1992 Oct 20, 2015

Thank you so much!!!!! Your solution helps me solve this problem perfectly!

Thank you so much!!!!! Your solution helps me solve this problem perfectly!

@Gusbenz

This comment has been minimized.

Show comment Hide comment
@Gusbenz

Gusbenz Oct 21, 2015

Thanks! This was helpful and useful! Again, thanks!

Gusbenz commented Oct 21, 2015

Thanks! This was helpful and useful! Again, thanks!

@UlisesGascon

This comment has been minimized.

Show comment Hide comment
@UlisesGascon

UlisesGascon Oct 28, 2015

Thanks! This saved my day!! πŸ‘

Thanks! This saved my day!! πŸ‘

@njv

This comment has been minimized.

Show comment Hide comment
@njv

njv Oct 29, 2015

Thank you!

njv commented Oct 29, 2015

Thank you!

@mattsilv

This comment has been minimized.

Show comment Hide comment
@mattsilv

mattsilv Nov 2, 2015

thank you. Worked well on OSX 10.10

mattsilv commented Nov 2, 2015

thank you. Worked well on OSX 10.10

@fwahlqvist

This comment has been minimized.

Show comment Hide comment
@fwahlqvist

fwahlqvist Nov 2, 2015

Thanks πŸ‘

Thanks πŸ‘

@obouchari

This comment has been minimized.

Show comment Hide comment
@obouchari

obouchari Nov 3, 2015

Thanks! πŸ‘

Thanks! πŸ‘

@MikaelCarpenter

This comment has been minimized.

Show comment Hide comment
@MikaelCarpenter

MikaelCarpenter Nov 4, 2015

getting -bash: /usr/local/bin/npm: No such file or directory any ideas?

getting -bash: /usr/local/bin/npm: No such file or directory any ideas?

@FullstackJack

This comment has been minimized.

Show comment Hide comment
@FullstackJack

FullstackJack Nov 5, 2015

Thanks, but I had to do the following to get mine to install all the way:

cd ~
rm -rf /usr/local/lib/node_modules
brew uninstall node
brew install node --without-npm
echo prefix=~/.node >> ~/.npmrc
sudo chown -R $(whoami) /usr/local
brew link --overwrite  node
curl -L https://www.npmjs.com/install.sh | sh

Permission Denied will occur if calling curl from a directory you don't have write permissions. I didn't realize I was in the wrong directory at first and foolishly kept making that mistake while searching for solutions.

Thanks, but I had to do the following to get mine to install all the way:

cd ~
rm -rf /usr/local/lib/node_modules
brew uninstall node
brew install node --without-npm
echo prefix=~/.node >> ~/.npmrc
sudo chown -R $(whoami) /usr/local
brew link --overwrite  node
curl -L https://www.npmjs.com/install.sh | sh

Permission Denied will occur if calling curl from a directory you don't have write permissions. I didn't realize I was in the wrong directory at first and foolishly kept making that mistake while searching for solutions.

@opfertunes

This comment has been minimized.

Show comment Hide comment
@opfertunes

opfertunes Nov 10, 2015

You sir ROCK

You sir ROCK

@jiyinyiyong

This comment has been minimized.

Show comment Hide comment
@jiyinyiyong

jiyinyiyong Nov 11, 2015

I actually fixed my npm with this:

brew postinstall node

http://forums.webhook.com/t/bash-npm-command-not-found-resolved/66/7

I actually fixed my npm with this:

brew postinstall node

http://forums.webhook.com/t/bash-npm-command-not-found-resolved/66/7

@DavidJBarnes

This comment has been minimized.

Show comment Hide comment
@DavidJBarnes

DavidJBarnes Nov 12, 2015

Thanks you!!

Thanks you!!

@backspaces

This comment has been minimized.

Show comment Hide comment
@backspaces

backspaces Nov 12, 2015

Boy, this makes me feel uneasy. All my hacking uses node/npm daily. I currently have the install from their site, done using the npm trick of not using admin directories: https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md

Brew doctor gives me the list of 110 /usr/local/include/node header files. Sigh.

So you promise that if I remove the node/npm site's install, along with the global npm modules, then do as suggested to use homebrew for managing node/npm .. mainly npm .. I'll be able to update both node and npm via homebrew safely?

You mention also deleting all the global installs. What about the --save and --save-dev local developer npm package installs? Do I have to also delete them? I.e. when I update them, will they fail, or just work, only global packages are at risk?

How in the world did we get into this mess! Sorry to be grouchy, and thanks for the help. A LOT! :)

Boy, this makes me feel uneasy. All my hacking uses node/npm daily. I currently have the install from their site, done using the npm trick of not using admin directories: https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md

Brew doctor gives me the list of 110 /usr/local/include/node header files. Sigh.

So you promise that if I remove the node/npm site's install, along with the global npm modules, then do as suggested to use homebrew for managing node/npm .. mainly npm .. I'll be able to update both node and npm via homebrew safely?

You mention also deleting all the global installs. What about the --save and --save-dev local developer npm package installs? Do I have to also delete them? I.e. when I update them, will they fail, or just work, only global packages are at risk?

How in the world did we get into this mess! Sorry to be grouchy, and thanks for the help. A LOT! :)

@alexortiz201

This comment has been minimized.

Show comment Hide comment
@alexortiz201

alexortiz201 Nov 27, 2015

Thought I'd make a note of this, as of right now:
node v5.1.0 && npm -v3.5.0

I just recently updated and I realized none of my global commands were working. Went through the lengthy process up top and ran into the issue with rif... something not working when curl'ing npm.

β€’ Fixed this by running suggested tip up above -> rm -rf ~/.npm
β€’ Then, curl'ed again which worked. Afterwards I would run npm outdated and kept seeing and npm ERR! addLocal ..../package....
β€’ Fixed this by running npm install -g npm@latest
β€’ Afterwards I was noticing failures when trying npm upgrade -g, even tried npm upgrade -g and it still didn't work
β€’ Fixed this by npm uninstalling global packages that didn't upgrade with the npm upgrade -g and reinstalling the global package (in other words anything showing up when running npm outdated -g)

I think it might have to do with how deps are handled in the newer versions because something I noticed was that any packages' deprecated deps were getting updated, this didn't happen before. Well, not a node expert so I'll leave the diagnosis to the pros.

Thought I'd make a note of this, as of right now:
node v5.1.0 && npm -v3.5.0

I just recently updated and I realized none of my global commands were working. Went through the lengthy process up top and ran into the issue with rif... something not working when curl'ing npm.

β€’ Fixed this by running suggested tip up above -> rm -rf ~/.npm
β€’ Then, curl'ed again which worked. Afterwards I would run npm outdated and kept seeing and npm ERR! addLocal ..../package....
β€’ Fixed this by running npm install -g npm@latest
β€’ Afterwards I was noticing failures when trying npm upgrade -g, even tried npm upgrade -g and it still didn't work
β€’ Fixed this by npm uninstalling global packages that didn't upgrade with the npm upgrade -g and reinstalling the global package (in other words anything showing up when running npm outdated -g)

I think it might have to do with how deps are handled in the newer versions because something I noticed was that any packages' deprecated deps were getting updated, this didn't happen before. Well, not a node expert so I'll leave the diagnosis to the pros.

@neraliu

This comment has been minimized.

Show comment Hide comment
@neraliu

neraliu Dec 1, 2015

super

neraliu commented Dec 1, 2015

super

@mesut

This comment has been minimized.

Show comment Hide comment
@mesut

mesut Dec 5, 2015

Thanks a lot

mesut commented Dec 5, 2015

Thanks a lot

@AshCoolman

This comment has been minimized.

Show comment Hide comment
@AshCoolman

AshCoolman Dec 5, 2015

Worked for me

Worked for me

@wiktusser

This comment has been minimized.

Show comment Hide comment
@wiktusser

wiktusser Dec 5, 2015

thanks lot!

thanks lot!

@rgiaccio

This comment has been minimized.

Show comment Hide comment
@rgiaccio

rgiaccio Dec 7, 2015

Many thanks!

rgiaccio commented Dec 7, 2015

Many thanks!

@alphapilgrim

This comment has been minimized.

Show comment Hide comment
@alphapilgrim

alphapilgrim Dec 9, 2015

Cheers! Thank you!

Cheers! Thank you!

@luis-carvalho

This comment has been minimized.

Show comment Hide comment
@luis-carvalho

luis-carvalho Dec 9, 2015

Huuuuuge thanks! 🀘

Huuuuuge thanks! 🀘

@alextrastero

This comment has been minimized.

Show comment Hide comment
@alextrastero

alextrastero Dec 11, 2015

Outstanding! πŸ‘

Outstanding! πŸ‘

@judahstevenson

This comment has been minimized.

Show comment Hide comment
@judahstevenson

judahstevenson Dec 15, 2015

This worked for me. I just had to update the PATH in my .bash_profile as I did not have a .path file, and this walkthrough held my hand nicely as I did it: http://dandean.com/nodejs-npm-express-osx/

This worked for me. I just had to update the PATH in my .bash_profile as I did not have a .path file, and this walkthrough held my hand nicely as I did it: http://dandean.com/nodejs-npm-express-osx/

@bertelledani

This comment has been minimized.

Show comment Hide comment
@bertelledani

bertelledani Dec 16, 2015

Thanks a lot! πŸ‘

Thanks a lot! πŸ‘

@LukeMichaels

This comment has been minimized.

Show comment Hide comment
@LukeMichaels

LukeMichaels Dec 17, 2015

Thanks πŸ˜„

Thanks πŸ˜„

@rowrodrigues

This comment has been minimized.

Show comment Hide comment
@rowrodrigues

rowrodrigues Dec 21, 2015

Thanks!

Thanks!

@amiralimatin

This comment has been minimized.

Show comment Hide comment
@amiralimatin

amiralimatin Dec 22, 2015

great help guys, worked without any problems, thanks !

great help guys, worked without any problems, thanks !

@MayankGoel1991

This comment has been minimized.

Show comment Hide comment
@MayankGoel1991

MayankGoel1991 Dec 25, 2015

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'cache', 'clean' ]
2 info using npm@1.4.28
3 info using node@v0.10.37
4 verbose node symlink /usr/bin/node
5 error Error: EACCES, unlink '/home/trinisoft/.npm/accepts/1.2.13'
5 error { [Error: EACCES, unlink '/home/trinisoft/.npm/accepts/1.2.13']
5 error errno: 3,
5 error code: 'EACCES',
5 error path: '/home/trinisoft/.npm/accepts/1.2.13' }
6 error Please try running this command again as root/Administrator.
7 error System Linux 3.16.0-51-generic
8 error command "/usr/bin/node" "/usr/bin/npm" "cache" "clean"
9 error cwd /home/trinisoft/Desktop/mayankproject
10 error node -v v0.10.37
11 error npm -v 1.4.28
12 error path /home/trinisoft/.npm/accepts/1.2.13
13 error code EACCES
14 error errno 3
15 error stack Error: EACCES, unlink '/home/trinisoft/.npm/accepts/1.2.13'
16 verbose exit [ 3, true ]

hey can anyone help me immediately by adding query on my id themayankgoel.mg@gmail.com,....................plz help me!!!! !important

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'cache', 'clean' ]
2 info using npm@1.4.28
3 info using node@v0.10.37
4 verbose node symlink /usr/bin/node
5 error Error: EACCES, unlink '/home/trinisoft/.npm/accepts/1.2.13'
5 error { [Error: EACCES, unlink '/home/trinisoft/.npm/accepts/1.2.13']
5 error errno: 3,
5 error code: 'EACCES',
5 error path: '/home/trinisoft/.npm/accepts/1.2.13' }
6 error Please try running this command again as root/Administrator.
7 error System Linux 3.16.0-51-generic
8 error command "/usr/bin/node" "/usr/bin/npm" "cache" "clean"
9 error cwd /home/trinisoft/Desktop/mayankproject
10 error node -v v0.10.37
11 error npm -v 1.4.28
12 error path /home/trinisoft/.npm/accepts/1.2.13
13 error code EACCES
14 error errno 3
15 error stack Error: EACCES, unlink '/home/trinisoft/.npm/accepts/1.2.13'
16 verbose exit [ 3, true ]

hey can anyone help me immediately by adding query on my id themayankgoel.mg@gmail.com,....................plz help me!!!! !important

@edanedison

This comment has been minimized.

Show comment Hide comment
@edanedison

edanedison Dec 29, 2015

Really helped me out. Thanks :)

Really helped me out. Thanks :)

@BahiHussein

This comment has been minimized.

Show comment Hide comment
@BahiHussein

BahiHussein Jan 1, 2016

Thanks

Thanks

@iposton

This comment has been minimized.

Show comment Hide comment
@iposton

iposton Jan 2, 2016

This worked for me as well. I don't understand why npm install -g npm deleted my npm without using sudo in the first place. These directions fixed my npm, but now when I install something I get a full width progress bar. and the install process looks different. not that it's overly important but did this happen to anyone else and do you happen to know why npm install looks different? maybe because I reinstalled node and everything is new and up to date now.

iposton commented Jan 2, 2016

This worked for me as well. I don't understand why npm install -g npm deleted my npm without using sudo in the first place. These directions fixed my npm, but now when I install something I get a full width progress bar. and the install process looks different. not that it's overly important but did this happen to anyone else and do you happen to know why npm install looks different? maybe because I reinstalled node and everything is new and up to date now.

@Red4x

This comment has been minimized.

Show comment Hide comment
@Red4x

Red4x Jan 7, 2016

Thank you it does helped me πŸ’ƒ

Red4x commented Jan 7, 2016

Thank you it does helped me πŸ’ƒ

@aldorr

This comment has been minimized.

Show comment Hide comment
@aldorr

aldorr Jan 13, 2016

Perfect!

aldorr commented Jan 13, 2016

Perfect!

@rajankambaliya

This comment has been minimized.

Show comment Hide comment
@rajankambaliya

rajankambaliya Jan 20, 2016

Thanks!

Thanks!

@djperezh

This comment has been minimized.

Show comment Hide comment
@djperezh

djperezh Jan 21, 2016

Thx !!!... that solve my ploblem for "cannot find module 'asn1'" error when trying to run npm commands

Thx !!!... that solve my ploblem for "cannot find module 'asn1'" error when trying to run npm commands

@jamigibbs

This comment has been minimized.

Show comment Hide comment
@jamigibbs

jamigibbs Jan 22, 2016

Thank you for this! For anyone else struggling with where to add export PATH="$HOME/.node/bin:$PATH", I had to put the export in ~/.bash_profile.

Thank you for this! For anyone else struggling with where to add export PATH="$HOME/.node/bin:$PATH", I had to put the export in ~/.bash_profile.

@freddiecabrera

This comment has been minimized.

Show comment Hide comment
@freddiecabrera

freddiecabrera Jan 29, 2016

I get this when I do brew install node --without-npm

Last 15 lines from /Users/freddiecabrera/Library/Logs/Homebrew/node/02.make:
         ^
In file included from ../deps/gtest/src/gtest-death-test.cc:34:
In file included from ../deps/gtest/include/gtest/gtest-death-test.h:41:
In file included from ../deps/gtest/include/gtest/internal/gtest-death-test-internal.h:40:
In file included from ../deps/gtest/include/gtest/internal/gtest-internal.h:40:
../deps/gtest/include/gtest/internal/gtest-port.h:259:10: fatal error: 'ctype.h' file not found
#include <ctype.h>   // for isspace, etc
         ^
1 error generated.
1 error generated.
make[1]: *** [/private/tmp/node20160128-4235-1ux7s39/node-v5.5.0/out/Release/obj.target/gtest/deps/gtest/src/gtest-port.o] Error 1
make[1]: *** [/private/tmp/node20160128-4235-1ux7s39/node-v5.5.0/out/Release/obj.target/gtest/deps/gtest/src/gtest-filepath.o] Error 1
1 error generated.
make[1]: *** [/private/tmp/node20160128-4235-1ux7s39/node-v5.5.0/out/Release/obj.target/gtest/deps/gtest/src/gtest-death-test.o] Error 1
make: *** [node] Error 2

READ THIS: https://git.io/brew-troubleshooting

I get this when I do brew install node --without-npm

Last 15 lines from /Users/freddiecabrera/Library/Logs/Homebrew/node/02.make:
         ^
In file included from ../deps/gtest/src/gtest-death-test.cc:34:
In file included from ../deps/gtest/include/gtest/gtest-death-test.h:41:
In file included from ../deps/gtest/include/gtest/internal/gtest-death-test-internal.h:40:
In file included from ../deps/gtest/include/gtest/internal/gtest-internal.h:40:
../deps/gtest/include/gtest/internal/gtest-port.h:259:10: fatal error: 'ctype.h' file not found
#include <ctype.h>   // for isspace, etc
         ^
1 error generated.
1 error generated.
make[1]: *** [/private/tmp/node20160128-4235-1ux7s39/node-v5.5.0/out/Release/obj.target/gtest/deps/gtest/src/gtest-port.o] Error 1
make[1]: *** [/private/tmp/node20160128-4235-1ux7s39/node-v5.5.0/out/Release/obj.target/gtest/deps/gtest/src/gtest-filepath.o] Error 1
1 error generated.
make[1]: *** [/private/tmp/node20160128-4235-1ux7s39/node-v5.5.0/out/Release/obj.target/gtest/deps/gtest/src/gtest-death-test.o] Error 1
make: *** [node] Error 2

READ THIS: https://git.io/brew-troubleshooting
@thatstoast

This comment has been minimized.

Show comment Hide comment
@thatstoast

thatstoast Jan 29, 2016

Thank you so much. I am a Grunt noob and thought I was doomed. You rule!

Thank you so much. I am a Grunt noob and thought I was doomed. You rule!

@suryateja-nerusu

This comment has been minimized.

Show comment Hide comment
@suryateja-nerusu

suryateja-nerusu Jan 29, 2016

thank you so much

thank you so much

@paprende

This comment has been minimized.

Show comment Hide comment
@paprende

paprende Feb 5, 2016

Works a charm. thanks

paprende commented Feb 5, 2016

Works a charm. thanks

@tuhinkanti

This comment has been minimized.

Show comment Hide comment
@tuhinkanti

tuhinkanti Feb 11, 2016

πŸ‘

πŸ‘

@tjaensch

This comment has been minimized.

Show comment Hide comment
@tjaensch

tjaensch Feb 13, 2016

Worked for me, thanks for the step by step guide!

Worked for me, thanks for the step by step guide!

@JoelChev

This comment has been minimized.

Show comment Hide comment
@JoelChev

JoelChev Feb 16, 2016

This finally fixed issues I was dealing with with my node, brew and bower installs. Thank you so very much! :)

This finally fixed issues I was dealing with with my node, brew and bower installs. Thank you so very much! :)

@mirontoli

This comment has been minimized.

Show comment Hide comment
@mirontoli

mirontoli Feb 20, 2016

After the steps provided here, I added following

export PATH="$HOME/.npm-packages/bin:$PATH"

Otherwise npm pointed to the wrong location (set by npm installer)

After the steps provided here, I added following

export PATH="$HOME/.npm-packages/bin:$PATH"

Otherwise npm pointed to the wrong location (set by npm installer)

@winnemucca

This comment has been minimized.

Show comment Hide comment
@winnemucca

winnemucca Mar 4, 2016

I got permission denied when I removed the node_modules. Do I have to do this as sudo?

I got permission denied when I removed the node_modules. Do I have to do this as sudo?

@letnotimitateothers

This comment has been minimized.

Show comment Hide comment
@letnotimitateothers

letnotimitateothers Mar 10, 2016

The process of @mmizutani solved my issue (I was stuck with -- npm: command not found --)
I think it's recommended to do a clean un-installation of the previous node.
brew uninstall node --force node

The process of @mmizutani solved my issue (I was stuck with -- npm: command not found --)
I think it's recommended to do a clean un-installation of the previous node.
brew uninstall node --force node

@ricardokdz

This comment has been minimized.

Show comment Hide comment
@ricardokdz

ricardokdz Mar 22, 2016

+1

+1

@larssn

This comment has been minimized.

Show comment Hide comment
@larssn

larssn Mar 23, 2016

This guide unfortunately results in npm being unable to update itself:
$> npm update npm -g
npm ERR! addLocal Could not install /private/var/folders/pm/8bjhd30n6glfm340_ff1ln3c0000gp/T/npm.65676/package

Check npm/npm#11385

larssn commented Mar 23, 2016

This guide unfortunately results in npm being unable to update itself:
$> npm update npm -g
npm ERR! addLocal Could not install /private/var/folders/pm/8bjhd30n6glfm340_ff1ln3c0000gp/T/npm.65676/package

Check npm/npm#11385

@JustJenFelice

This comment has been minimized.

Show comment Hide comment
@JustJenFelice

JustJenFelice Mar 31, 2016

Thank you so much, @mirontoli - your suggestion re: adding NPM to my dot files did the trick!

Also, for anybody who is struggling to update NPM, have you tried the latest suggestion from the NPM site:

Node comes with npm installed so you should have a version of npm. However, npm gets updated more frequently than Node does, so you'll want to make sure it's the latest version.
sudo npm install npm -g

I noticed that a number of people (most recently @larssn) were trying to update instead of install - might be worth a try.

Thank you so much, @mirontoli - your suggestion re: adding NPM to my dot files did the trick!

Also, for anybody who is struggling to update NPM, have you tried the latest suggestion from the NPM site:

Node comes with npm installed so you should have a version of npm. However, npm gets updated more frequently than Node does, so you'll want to make sure it's the latest version.
sudo npm install npm -g

I noticed that a number of people (most recently @larssn) were trying to update instead of install - might be worth a try.

@aaleksa

This comment has been minimized.

Show comment Hide comment
@aaleksa

aaleksa Apr 4, 2016

As mentioned @mirontoli
don't forget add into ~/.bash_profile this path:

export PATH="$HOME/.npm-packages/bin:$PATH"
otherwise it will not fin npm

aaleksa commented Apr 4, 2016

As mentioned @mirontoli
don't forget add into ~/.bash_profile this path:

export PATH="$HOME/.npm-packages/bin:$PATH"
otherwise it will not fin npm

@lordKnighton

This comment has been minimized.

Show comment Hide comment
@lordKnighton

lordKnighton Apr 10, 2016

Just a head up, brew install node --without-npm If it looks like it stuck, just wait a bit longer
mine took 15 mins to finish

Just a head up, brew install node --without-npm If it looks like it stuck, just wait a bit longer
mine took 15 mins to finish

@KalenAnson

This comment has been minimized.

Show comment Hide comment
@KalenAnson

KalenAnson Apr 15, 2016

+1 and yeah, node took days to install this time around.

+1 and yeah, node took days to install this time around.

@unluisco

This comment has been minimized.

Show comment Hide comment
@unluisco

unluisco Apr 17, 2016

Thanks!

Thanks!

@rickgregory

This comment has been minimized.

Show comment Hide comment
@rickgregory

rickgregory Apr 21, 2016

curl -L https://www.npmjs.com/install.sh | sh KEPT giving me errors... if anyone else runs into this... update your PATH first, then run the script.

curl -L https://www.npmjs.com/install.sh | sh KEPT giving me errors... if anyone else runs into this... update your PATH first, then run the script.

@elchingon

This comment has been minimized.

Show comment Hide comment
@elchingon

elchingon Apr 26, 2016

There were some libraries conflicting with my Homebrew install in my $PATH..
I uninstalled node completely, then ran brew doctor and resolved all the issues in brew.
I then reinstalled node with brew.
brew install node

brew link --overwrite --dry-run node

brew link --overwrite node
Finally I was able to install libraries with npm again... thanks for the support and sharing this.

elchingon commented Apr 26, 2016

There were some libraries conflicting with my Homebrew install in my $PATH..
I uninstalled node completely, then ran brew doctor and resolved all the issues in brew.
I then reinstalled node with brew.
brew install node

brew link --overwrite --dry-run node

brew link --overwrite node
Finally I was able to install libraries with npm again... thanks for the support and sharing this.

@vfweber

This comment has been minimized.

Show comment Hide comment
@vfweber

vfweber Apr 27, 2016

worked like a charm! Thank you!

vfweber commented Apr 27, 2016

worked like a charm! Thank you!

@iwasdavid

This comment has been minimized.

Show comment Hide comment
@iwasdavid

iwasdavid Apr 30, 2016

I wish I'd found this 20 hours ago! Thanks!

I wish I'd found this 20 hours ago! Thanks!

@hbhakhra

This comment has been minimized.

Show comment Hide comment
@hbhakhra

hbhakhra May 8, 2016

I've been struggling to get these instructions to work because I need to LTS version so I just gave up and decided to try the package from npmjs.org and that seems to be working great.

hbhakhra commented May 8, 2016

I've been struggling to get these instructions to work because I need to LTS version so I just gave up and decided to try the package from npmjs.org and that seems to be working great.

@somecallmejosh

This comment has been minimized.

Show comment Hide comment
@somecallmejosh

somecallmejosh May 26, 2016

@mmizutani - your method is the only one that worked for me! Thank you for sharing it!

@mmizutani - your method is the only one that worked for me! Thank you for sharing it!

@anthonygore

This comment has been minimized.

Show comment Hide comment
@anthonygore

anthonygore Jun 7, 2016

The solution by @sacwebdeveloper worked for me. Good advice to do cd ~ before starting to ensure you don't need sudo.

The solution by @sacwebdeveloper worked for me. Good advice to do cd ~ before starting to ensure you don't need sudo.

@briangordon

This comment has been minimized.

Show comment Hide comment
@briangordon

briangordon Jun 7, 2016

I used these steps to install node and npm from scratch on my new machine:

brew install node --without-npm
echo prefix=~/.node >> ~/.npmrc
curl -L https://www.npmjs.org/install.sh | sh
echo "export PATH=\"\$HOME/.node/bin:\$PATH\"" >> ~/.bash_profile
npm install -g npm@latest

Note that the last command comes from npm/npm#11385.

I used these steps to install node and npm from scratch on my new machine:

brew install node --without-npm
echo prefix=~/.node >> ~/.npmrc
curl -L https://www.npmjs.org/install.sh | sh
echo "export PATH=\"\$HOME/.node/bin:\$PATH\"" >> ~/.bash_profile
npm install -g npm@latest

Note that the last command comes from npm/npm#11385.

@ashecret

This comment has been minimized.

Show comment Hide comment
@ashecret

ashecret Jun 8, 2016

JUNE 8, 2016

I didn't have to install npm separately like I had to do before.

brew uninstall node to unintsall node
Use brew doctor to find any issue(s) and fix them.
I had to use brew prune to remove broken symlinks

Now brew install node to install node
Verify node and npm with node --version and npm --version

ashecret commented Jun 8, 2016

JUNE 8, 2016

I didn't have to install npm separately like I had to do before.

brew uninstall node to unintsall node
Use brew doctor to find any issue(s) and fix them.
I had to use brew prune to remove broken symlinks

Now brew install node to install node
Verify node and npm with node --version and npm --version

@MarkEspinosa

This comment has been minimized.

Show comment Hide comment
@MarkEspinosa

MarkEspinosa Jun 18, 2016

can someone please help me out here I tried doing the steps @briangordon provided but I'm getting

ms-M:~ z$ echo "export PATH="$HOME/.node/bin:$PATH"" >> /.bash_profile
ms-M:
z$ npm install -g npm@latest
-bash: /usr/local/bin/npm: No such file or directory

MarkEspinosa commented Jun 18, 2016

can someone please help me out here I tried doing the steps @briangordon provided but I'm getting

ms-M:~ z$ echo "export PATH="$HOME/.node/bin:$PATH"" >> /.bash_profile
ms-M:
z$ npm install -g npm@latest
-bash: /usr/local/bin/npm: No such file or directory

@terryjray

This comment has been minimized.

Show comment Hide comment
@terryjray

terryjray Jun 19, 2016

@MarkEspinosa, did you source your .bash_profile after modifying your path?

source ~/.bash_profile

You should be able to run the env command (env | grep PATH) and see that you've got the ~/.node/bin directory in your path.

@MarkEspinosa, did you source your .bash_profile after modifying your path?

source ~/.bash_profile

You should be able to run the env command (env | grep PATH) and see that you've got the ~/.node/bin directory in your path.

@Sanabria

This comment has been minimized.

Show comment Hide comment
@Sanabria

Sanabria Jun 29, 2016

@mirontoli Thank you! The export PATH="$HOME/.npm-packages/bin:$PATH" resolved my -bash: npm: command not found issue!

@mirontoli Thank you! The export PATH="$HOME/.npm-packages/bin:$PATH" resolved my -bash: npm: command not found issue!

@bySabi

This comment has been minimized.

Show comment Hide comment
@bySabi

bySabi Jul 4, 2016

Fix npm bash completion with:

echo 'source ~/.node/lib/node_modules/npm/lib/utils/completion.sh' >> ~/.bash_profile
source ~/.bash_profile

bySabi commented Jul 4, 2016

Fix npm bash completion with:

echo 'source ~/.node/lib/node_modules/npm/lib/utils/completion.sh' >> ~/.bash_profile
source ~/.bash_profile
@dhcodes

This comment has been minimized.

Show comment Hide comment
@dhcodes

dhcodes Jul 4, 2016

Thanks!

dhcodes commented Jul 4, 2016

Thanks!

@yqrashawn

This comment has been minimized.

Show comment Hide comment
@yqrashawn

yqrashawn Jul 5, 2016

Why I got command not found in my zsh on my mac pro. This works fine on my Macbook.

Why I got command not found in my zsh on my mac pro. This works fine on my Macbook.

@VirenMohindra

This comment has been minimized.

Show comment Hide comment
@VirenMohindra

VirenMohindra Jul 8, 2016

thank you for this! Remember to curl in the home directory and not anywhere else otherwise you're npm installation will keep on failing.
From the above comments, adding export PATH="$HOME/.npm-packages/bin:$PATH" into your .bash_profile.

thank you for this! Remember to curl in the home directory and not anywhere else otherwise you're npm installation will keep on failing.
From the above comments, adding export PATH="$HOME/.npm-packages/bin:$PATH" into your .bash_profile.

@emandino

This comment has been minimized.

Show comment Hide comment
@emandino

emandino Jul 19, 2016

This is my 3rd attempt at completing this installation over the last year and I've been struggling with it over the last month (again). Finally, I found a viable solution. Thank you guys, where would I be without my own brewing company? Here is what I had to do to ultimatelly make it work:

Warning: Running OS X El Capitan v10.11.15 on Mac mini (Late 2014)

brew doctor
brew update
rm -rf /usr/local/lib/node_modules
brew uninstall node

*In response to the homebrew warning errors I ran:
brew doctor
sudo port uninstall node
sudo mv /opt/local ~/macports
brew prune
brew doctor

*Once brew doctor adviced everything was fine and dandy I proceeded:
brew install node --without-npm
brew link --overwrite node
echo prefix=~/.npm-packages >> ~/.npmrc
curl -L https://www.npmjs.com/install.sh | sudo sh
echo export PATH="$HOME/.node/bin:$PATH"
echo export PATH="$HOME/.npm-packages/bin:$PATH" >> ~/.bash_profile
source ~/.bash_profile
sudo npm install -g npm@latest

Success!

Once again, thank you for all your contributions. I know, I know! Apple threatened to launch an update to macOS in the fall and everything is going to go down the drain again. I will cross that river when I reach that shore, now I have to "ketchup" (;-D) with all the stuff I have fallen behind. Owe you a keg!

This is my 3rd attempt at completing this installation over the last year and I've been struggling with it over the last month (again). Finally, I found a viable solution. Thank you guys, where would I be without my own brewing company? Here is what I had to do to ultimatelly make it work:

Warning: Running OS X El Capitan v10.11.15 on Mac mini (Late 2014)

brew doctor
brew update
rm -rf /usr/local/lib/node_modules
brew uninstall node

*In response to the homebrew warning errors I ran:
brew doctor
sudo port uninstall node
sudo mv /opt/local ~/macports
brew prune
brew doctor

*Once brew doctor adviced everything was fine and dandy I proceeded:
brew install node --without-npm
brew link --overwrite node
echo prefix=~/.npm-packages >> ~/.npmrc
curl -L https://www.npmjs.com/install.sh | sudo sh
echo export PATH="$HOME/.node/bin:$PATH"
echo export PATH="$HOME/.npm-packages/bin:$PATH" >> ~/.bash_profile
source ~/.bash_profile
sudo npm install -g npm@latest

Success!

Once again, thank you for all your contributions. I know, I know! Apple threatened to launch an update to macOS in the fall and everything is going to go down the drain again. I will cross that river when I reach that shore, now I have to "ketchup" (;-D) with all the stuff I have fallen behind. Owe you a keg!

@Brycetastic

This comment has been minimized.

Show comment Hide comment
@Brycetastic

Brycetastic Jul 21, 2016

I following the instructions, fixed npm i and npm i any dependencies. Now, I am having a similar problem with using webpack. Any one know what is going wrong?

> cars2@1.0.0 start /Users/bmarshall/cars2
> webpack-dev-server

module.js:442
    throw err;
    ^

Error: Cannot find module 'webpack-dev-middleware'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/webpack-dev-server/lib/Server.js:3:28)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/Users/bmarshall/.npm-packages/bin/npm" "start"
npm ERR! node v6.2.2
npm ERR! npm  v3.10.5
npm ERR! code ELIFECYCLE
npm ERR! cars2@1.0.0 start: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cars2@1.0.0 start script 'webpack-dev-server'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the cars2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack-dev-server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs cars2
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls cars2
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/bmarshall/cars2/npm-debug.log

I following the instructions, fixed npm i and npm i any dependencies. Now, I am having a similar problem with using webpack. Any one know what is going wrong?

> cars2@1.0.0 start /Users/bmarshall/cars2
> webpack-dev-server

module.js:442
    throw err;
    ^

Error: Cannot find module 'webpack-dev-middleware'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/webpack-dev-server/lib/Server.js:3:28)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/Users/bmarshall/.npm-packages/bin/npm" "start"
npm ERR! node v6.2.2
npm ERR! npm  v3.10.5
npm ERR! code ELIFECYCLE
npm ERR! cars2@1.0.0 start: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cars2@1.0.0 start script 'webpack-dev-server'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the cars2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack-dev-server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs cars2
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls cars2
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/bmarshall/cars2/npm-debug.log
@eno812

This comment has been minimized.

Show comment Hide comment
@eno812

eno812 Aug 4, 2016

Hi,

I installed NPM ages ago and now I can't remember if I installed directly or via hombrew. When I run the command 'which npm' it returns this, /usr/local/bin/npm

Does that mean it was installed directly from npm or brew.

The command 'which node' returns this, /usr/local/bin/node

But I know that node is installed via brew also.

I think I need help to clean up my install of NPM. Any suggestions?

eno812 commented Aug 4, 2016

Hi,

I installed NPM ages ago and now I can't remember if I installed directly or via hombrew. When I run the command 'which npm' it returns this, /usr/local/bin/npm

Does that mean it was installed directly from npm or brew.

The command 'which node' returns this, /usr/local/bin/node

But I know that node is installed via brew also.

I think I need help to clean up my install of NPM. Any suggestions?

@interglobalmedia

This comment has been minimized.

Show comment Hide comment
@interglobalmedia

interglobalmedia Aug 4, 2016

Hi @eno812,

I am having npm issues with the -g flag, and came across this npm documentation: https://docs.npmjs.com/getting-started/fixing-npm-permissions. However, it resulted in even more questions on my part re fixing permissions. Specifically about altering my .profile (which I can't alter). So opened an issue in which I am asking whether I can create another profile just naming it differently and then using that. Waiting for their answer. But it might help you generally with your problem. You can also reach out to them directly via their repo if you have any other questions that might not be answerable by Homebrew. And as you said, you might not have installed with it. I originally was not able to because if I remember correctly, I THINK I had an issue installing Node with Homebrew. But I can't swear upon it. It was so long ago.

interglobalmedia commented Aug 4, 2016

Hi @eno812,

I am having npm issues with the -g flag, and came across this npm documentation: https://docs.npmjs.com/getting-started/fixing-npm-permissions. However, it resulted in even more questions on my part re fixing permissions. Specifically about altering my .profile (which I can't alter). So opened an issue in which I am asking whether I can create another profile just naming it differently and then using that. Waiting for their answer. But it might help you generally with your problem. You can also reach out to them directly via their repo if you have any other questions that might not be answerable by Homebrew. And as you said, you might not have installed with it. I originally was not able to because if I remember correctly, I THINK I had an issue installing Node with Homebrew. But I can't swear upon it. It was so long ago.

@dreamyguy

This comment has been minimized.

Show comment Hide comment
@dreamyguy

dreamyguy Aug 5, 2016

For those still struggling to the point of giving up hope in node, try using https://github.com/brock/node-reinstall.

It will reset your node environment and you will be able to go on with your life. ✨

I tried using homebrew to install node before and will strongly advise against it. The node-reinstall I mentioned above will get rid of falty installs, do a clean install and from there on you can rely on nvm to manage node versions... Peace!

For those still struggling to the point of giving up hope in node, try using https://github.com/brock/node-reinstall.

It will reset your node environment and you will be able to go on with your life. ✨

I tried using homebrew to install node before and will strongly advise against it. The node-reinstall I mentioned above will get rid of falty installs, do a clean install and from there on you can rely on nvm to manage node versions... Peace!

@aleehpandita

This comment has been minimized.

Show comment Hide comment
@aleehpandita

aleehpandita Aug 13, 2016

Thanks!

Thanks!

@numanayhan

This comment has been minimized.

Show comment Hide comment
@numanayhan

numanayhan Aug 24, 2016

thank you my error is solved

numanayhan commented Aug 24, 2016

thank you my error is solved

@Vintharas

This comment has been minimized.

Show comment Hide comment
@Vintharas

Vintharas Aug 25, 2016

Thanks! :)

Thanks! :)

@al-apex

This comment has been minimized.

Show comment Hide comment
@al-apex

al-apex Aug 25, 2016

In addition to the steps the author mentioned, I needed to modify my $PATH or my npm and my npm installed programs wouldn't run.

I added the following lines to my .bash_profile

export PATH="$HOME/.npm/bin:$PATH"
export PATH="$HOME/.npm-packages/bin:$PATH"

al-apex commented Aug 25, 2016

In addition to the steps the author mentioned, I needed to modify my $PATH or my npm and my npm installed programs wouldn't run.

I added the following lines to my .bash_profile

export PATH="$HOME/.npm/bin:$PATH"
export PATH="$HOME/.npm-packages/bin:$PATH"

@dmolesUC3

This comment has been minimized.

Show comment Hide comment
@dmolesUC3

dmolesUC3 Sep 7, 2016

I don't have either a ~/.node/bin or ~/.npm/bin directory. Not sure where npm actually installed itself, though I do have a ~/.npm directory full of things (none of which is an executable called npm).

dmolesUC3 commented Sep 7, 2016

I don't have either a ~/.node/bin or ~/.npm/bin directory. Not sure where npm actually installed itself, though I do have a ~/.npm directory full of things (none of which is an executable called npm).

@Monte9

This comment has been minimized.

Show comment Hide comment
@Monte9

Monte9 Sep 12, 2016

Worked for me too although I had to install node and npm from the node website directly. Here is what I did:

  1. rm -rf /usr/local/lib/node_modules
  2. brew uninstall node
  3. Download and install node from here: https://nodejs.org/en/download/current/
  4. Add export PATH=$PATH:/usr/local/bin to your .bash_profile or .bashrc
    Hope this helps.

Monte9 commented Sep 12, 2016

Worked for me too although I had to install node and npm from the node website directly. Here is what I did:

  1. rm -rf /usr/local/lib/node_modules
  2. brew uninstall node
  3. Download and install node from here: https://nodejs.org/en/download/current/
  4. Add export PATH=$PATH:/usr/local/bin to your .bash_profile or .bashrc
    Hope this helps.
@fanky10

This comment has been minimized.

Show comment Hide comment
@fanky10

fanky10 Sep 20, 2016

Thanks!

fanky10 commented Sep 20, 2016

Thanks!

@igor972

This comment has been minimized.

Show comment Hide comment
@igor972

igor972 Sep 24, 2016

Thanks <3

igor972 commented Sep 24, 2016

Thanks <3

@lamass

This comment has been minimized.

Show comment Hide comment
@lamass

lamass Sep 29, 2016

UR the Best!
Thanks a Million!

lamass commented Sep 29, 2016

UR the Best!
Thanks a Million!

@semihsezer

This comment has been minimized.

Show comment Hide comment
@semihsezer

semihsezer Oct 2, 2016

make sure to run "source ~/.bash_profile" after adding export PATH=$PATH:/usr/local/bin to your .bash_profile or .bashrc. This should be stated in the last step explicitly for dummies like me :)

thanks for this!

semihsezer commented Oct 2, 2016

make sure to run "source ~/.bash_profile" after adding export PATH=$PATH:/usr/local/bin to your .bash_profile or .bashrc. This should be stated in the last step explicitly for dummies like me :)

thanks for this!

@revelt

This comment has been minimized.

Show comment Hide comment
@revelt

revelt Oct 6, 2016

"Before you start, make a note of any globally installed npm packages."

If you came here because your npm itself is broken, you won't be able to call npm commands to view globally installed packages.
Luckily, you can see all of them by checking the folder: /usr/local/lib/node_modules!

revelt commented Oct 6, 2016

"Before you start, make a note of any globally installed npm packages."

If you came here because your npm itself is broken, you won't be able to call npm commands to view globally installed packages.
Luckily, you can see all of them by checking the folder: /usr/local/lib/node_modules!

@gowebvision

This comment has been minimized.

Show comment Hide comment
@gowebvision

gowebvision Oct 6, 2016

Worked on my issue too. Thanks!

Worked on my issue too. Thanks!

@srkrkalyan

This comment has been minimized.

Show comment Hide comment
@srkrkalyan

srkrkalyan Oct 14, 2016

Great ! it fixed my issue