我似乎无法让npm使用最新版本的节点(0.8.11)在os x mountain lion上工作。无论是从源代码构建,还是使用安装程序,我都会在尝试运行npm时找不到命令。我检查了/ usr / local / bin并且npm存在,这里是ln -l </ p>
lrwxr-xr-x 1 root wheel 38 Oct 2 16:33 npm -> ../lib/node_modules/npm/bin/npm-cli.js
以下是/ usr / local / lib / node_modules / npm / bin显示
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
从源代码运行'make install'时,出现以下错误
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
我的路径如下:
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
安装程序运行顺畅,没有错误,但我仍然不会执行npm。谢谢你的帮助!
答案 0 :(得分:0)
现在已经有几个月了,但node.js已更新为0.8.22,并已更正此问题。
如果您不想为这个程序安装Macport,首选方法是下载Mac OSX安装程序包。