Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM Command Not Found After Installing Node

I am having a very hard time getting the npm command to work, and unfortunately my knowledge of unix isn't good enough to solve this on my own. All I've done is brew install node, and I get the following errors:

When I type npm I get zsh: command not found: npm

Looking into this issue more I found this stack overflow answer:

Command not found after npm install in zsh

Following its advice I tried adding export PATH=/usr/local/share/npm/bin:$PATH to my .zshrc file. Still get the same error when typing npm

I can confirm it is in the path echo $PATH yields /Users/nicholashaley/.rbenv/shims:/Users/nicholashaley/.rbenv/bin:/Applications/Postgres.app/Contents/Versions/9.3/bin:/usr/local/heroku/bin:/usr/local/share/npm/bin:/usr/local/bin:/Applications/Postgres.app/Contents/Versions/9.3/bin:/usr/local/heroku/bin:/Users/nicholashaley/.rbenv/shims:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

I can also confirm that node has been installed node -v yields v0.12.2

Any ideas? I'm stumped

like image 241
Nicholas Haley Avatar asked Sep 23 '15 21:09

Nicholas Haley


People also ask

How do I fix npm not found?

The npm command not found error js server, which you can download from the nodejs.org website. Once you downloaded and installed Node. js, open the terminal and run the npm -v command. Once you see the npm version, you should be able to run the npm install command again.

Why my npm install is not working?

If your npm is broken: On Mac or Linux, reinstall npm. Windows: If you're on Windows and you have a broken installation, the easiest thing to do is to reinstall node from the official installer (see this note about installing the latest stable version).

Is npm installed when installing node?

NPM is included with Node. js installation. After you install Node. js, verify NPM installation by writing the following command in terminal or command prompt.


1 Answers

Not an answer, but maybe a solution...

Uninstall Node via brew: brew uninstall node

Then download Node from https://nodejs.org/en/download/ and install.

npm should then "just work".

like image 162
Adrian Lynch Avatar answered Oct 06 '22 01:10

Adrian Lynch