0

So I've got a brand new Macbook Pro running 10.10.3 (14D2134). I installed Node.js via their package installer you can download on https://nodejs.org/

From there I attempted to install grunt via NPM but after getting the error -bash: npm: command not found I realized NPM might need to installed in addition to the initial install of Node.

I tried removing Node all together following these instructions: How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X) with the intention of reinstalling both Node and NPM via Homebrew. However, after following the above instructions and attempting to install Node with Homebrew, I recieved an error saying that Node is already installed (apparently I didn't completely remove every trace of it) but it just wasn't linked. So I followed the command line prompts to link Node and did so successfully.

So here I am with Node installed but still getting this nonsense. Please send help. xoxo.

Last login: Mon Jun 29 08:36:45 on ttys000 Jeremys-MacBook-Pro:~ jeremypbeasley$ node -v v0.12.5 Jeremys-MacBook-Pro:~ jeremypbeasley$ npm install -bash: npm: command not found Jeremys-MacBook-Pro:~ jeremypbeasley$

I also tried sudo npm install npm -g then Password but got sudo: npm: command not found

I also tried looking into the path if this helps:

Jeremys-MacBook-Pro:~ jeremypbeasley$ which node /usr/local/bin/node Jeremys-MacBook-Pro:~ jeremypbeasley$ echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin Jeremys-MacBook-Pro:~ jeremypbeasley$ ls -al /usr/local/bin/npm /usr/local/lib/node_modules ls: /usr/local/bin/npm: No such file or directory /usr/local/lib/node_modules: total 0 drwxrwxr-x 2 502 staff 68 Jun 28 11:11 . drwxrwxr-x 5 502 staff 170 Jun 28 11:24 .. Jeremys-MacBook-Pro:~ jeremypbeasley$

Community
  • 1
  • 1
Jeremy P. Beasley
  • 639
  • 1
  • 7
  • 20
  • 2
    `npm` gets installed when you install Node so it's a bit of a puzzle. Can you add the output of `which node` and `echo $PATH` to your question? – robertklep Jun 29 '15 at 16:05
  • Added! Thanks so much. Looks like there's some weird repetition in my path but I don't really know what to do with it. – Jeremy P. Beasley Jun 29 '15 at 16:15
  • Can you also add the output for this: `ls -al /usr/local/bin/npm /usr/local/lib/node_modules` – robertklep Jun 29 '15 at 16:30
  • Your installation seems to be incomplete (well duh ;-). I can only suggest reinstalling using the official installer (the pkg version) once more (I use Homebrew myself, it's awesome, but for Node I use the official installer), after removing the Homebrew version first. – robertklep Jun 29 '15 at 16:46
  • What's the most sure way to remove all versions of Node completely and start from scratch? – Jeremy P. Beasley Jul 02 '15 at 22:03
  • You can try uninstalling the Homebrew package first (`brew uninstall node`), and run the official Node installer after that. – robertklep Jul 03 '15 at 05:08

1 Answers1

0

Those uninstall instructions are pretty old (written in 2012). I'd start by figuring out which installation of node your computer is using:

which node

You'll get something like:

/usr/local/bin/node

Follow that path (in Finder select Go > Go to folder... or hit shirt + command + g and paste the path). Node will either be an executation file or a link. If it's a link, follow it. It probably leads to homebrew's installation. That would be:

/usr/local/Cellar/node

If you haven't installed Xcode Command Line Tools, try that:

xcode-select --install

Let me know what you find.

  • Thanks! Xcode command line tools are installed already. `which node` responded with exactly what you wrote above. I went there in Finder and found the file `node` which is a link. I click the link and it opens Terminal with `~ jeremypbeasley$ /usr/local/Cellar/node/0.12.5/bin/node ; exit; >` If I select "Get Info" on the link file, it shows "Original: /usr/local/Cellar/node/0.12.5/bin/node" where I find the executable file in Finder. – Jeremy P. Beasley Jun 29 '15 at 16:33