isaacs/npm — Issue #1598: install script picks wrong directory with homebrew installed node
Author: mroth
Created: 2011-10-25 23:07:04+00:00
State: open

With a fresh install of node via homebrew, then attempting to install npm via install script, the installer seems to place the files in the Cellar directory rather than in the proper directory which is in the system path. E.g. npm ends up in /usr/local/Cellar/node/0.4.12/bin/npm versus /usr/local/bin/npm.

```
$ brew --version
0.8

$ which node
/usr/local/bin/node

$ node -v
v0.4.12

$ echo $NODE_PATH
/usr/local/lib/node

$ ls -l `which node`
lrwxr-xr-x 1 mroth staff 30 Oct 25 18:55 /usr/local/bin/node -> ../Cellar/node/0.4.12/bin/node

$ curl http://npmjs.org/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7147 100 7147 0 0 19194 0 --:--:-- --:--:-- --:--:-- 82149
tar=/usr/bin/tar
version:
bsdtar 2.8.3 - libarchive 2.8.3
Installing without make. This may fail.
fetching: http://registry.npmjs.org/npm/-/npm-1.0.102.tgz
0.4.12
1.0.102
cleanup prefix=/usr/local
altprefix=/usr/local/Cellar/node/0.4.12

All clean!
/usr/local/Cellar/node/0.4.12/bin/npm -> /usr/local/Cellar/node/0.4.12/lib/node_modules/npm/bin/npm-cli.js
/usr/local/Cellar/node/0.4.12/bin/npm_g -> /usr/local/Cellar/node/0.4.12/lib/node_modules/npm/bin/npm-cli.js
/usr/local/Cellar/node/0.4.12/bin/npm-g -> /usr/local/Cellar/node/0.4.12/lib/node_modules/npm/bin/npm-cli.js
npm@1.0.102 /usr/local/Cellar/node/0.4.12/lib/node_modules/npm
It worked
```

I've verified the same thing seems to happen when building from source with make as well.