I can't seem to get npm working on os x mountain lion with the latest version of node (0.8.11). Either building from source, or using the installer, I get a command not found when trying to run npm. I checked /usr/local/bin and npm is present, here's an ln -l
lrwxr-xr-x 1 root wheel 38 Oct 2 16:33 npm -> ../lib/node_modules/npm/bin/npm-cli.js
Following to /usr/local/lib/node_modules/npm/bin shows
drwxr-xr-x 4 24561 staff 136 Oct 2 16:33 node-gyp-bin
-rwxr-xr-x 1 root staff 274 Sep 27 12:39 npm
-rwxr-xr-x 1 root staff 2247 Sep 27 12:39 npm-cli.js
-rw-r--r-- 1 root staff 209 Sep 27 12:39 npm.cmd
-rwxr-xr-x 1 root staff 504 Sep 27 12:39 read-package-json.js
When running 'make install' from source, I get the following error
symlinking ../lib/node_modules/npm/bin/npm-cli.js -> /usr/local/bin/npm
updating shebang of /usr/local/bin/npm to /usr/local/bin/node
Traceback (most recent call last):
File "tools/install.py", line 225, in <module>
run(sys.argv[:])
File "tools/install.py", line 220, in run
if cmd == 'install': return files(install)
File "tools/install.py", line 203, in files
if 'true' == variables.get('node_install_npm'): npm_files(action)
File "tools/install.py", line 166, in npm_files
update_shebang(link_path, shebang)
File "tools/install.py", line 133, in update_shebang
s = open(path, 'r').read()
IOError: [Errno 2] No such file or directory: '/usr/local/bin/npm'
make: *** [install] Error 1
My path is the following:
bash:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin: No such file or directory
The installer runs smoothly with no errors, but I still won't execute npm. Thanks for any help!
This is now a few months old, however, node.js is updated to 0.8.22, and has corrected this issue.
The preferred method is to download the Mac OSX installer package if you do not want to install Macports for this one program.