11

I installed node and made sure that /usr/local/bin is in my $PATH.

I checked for node install version and location

[~]$node -v

v10.15.1


[~]$which node

/usr/local/bin/node

Why, when I cd into /usr/local/bin/, is there nothing there?

I'm on MacOS Mojave Version 10.14.2. I installed node version 10.15.1 using the installer downloaded from nodejs.org, and using the default options in the installer.

Here are the notes i took from the installer:

Welcome to the Node JS Installer -> This package will install: 

• Node.js v10.15.1 to /usr/local/bin/node 
• npm v6.4.1 to /usr/local/bin/npm 

Select the disk where you want to install nodejs -> MacintoshHD

(clicked install) ...

This package has installed: 

• Node.js v10.15.1 to /usr/local/bin/node 
• npm v6.4.1 to /usr/local/bin/npm 

Make sure that /usr/local/bin is in your $PATH.

Checked /usr/local/bin is in $PATH.

[~]$echo $PATH

:~/usr:bin:~/bin:usr/local/bin:usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:

But the when I check where node is installed:

[~]$which node

/usr/local/bin/node

[~]$cd usr/local/bin/node

-bash: cd: usr/local/bin/node: No such file or directory
Giacomo1968
  • 58,727
alan_k
  • 141

2 Answers2

9

The command

root@user:# whereis npm

should return the path to your node.js installation. It returns something like this:

/usr/bin/npm
DarkDiamond
  • 1,919
  • 11
  • 15
  • 21
3

I was looking in the wrong directory. Here is the explanation.

usr/local/bin/

is not the same as

/usr/local/bin/

The wrong one:

[~]$cd usr/local/bin
[bin]$ls -a
.       ..      .DS_Store
[bin]$cd /usr/local/bin/node
-bash: cd: /usr/local/bin/node: Not a directory

The right one:

[bin]$cd /usr/local/bin

Exists! Then

[bin]$ls -a

And node is indeed there.

From the mac terminal, there is the difference between usr and /usr.

Mokubai
  • 95,412
alan_k
  • 141