2012-10-02 81 views
3

我似乎無法使用最新版本的節點(0.8.11)獲得npm在os x mountain lion上的工作。無論是從源代碼構建還是使用安裝程序,我都會在嘗試運行npm時收到未找到的命令。我檢查的/ usr/local/bin目錄和NPM存在,這裏的-l麻煩在Mac上安裝npm

lrwxr-xr-x 1 root wheel 38 Oct 2 16:33 npm -> ../lib/node_modules/npm/bin/npm-cli.js 

的LN繼到/ 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 

當運行「使從源代碼安裝」,我得到以下錯誤

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。謝謝你的幫助!

+1

我不是山獅,但MacPorts對我來說工作的很好。你試過了嗎? – eWolf

+0

是的,我實際上結束了使用MacPorts,它完美運行 – user1715403

+0

請注意,'/ usr/local/bin/npm'是一個JavaScript腳本,試圖運行'節點'(它發現使用標準'shebang'的做法:/ usr/bin/env節點)。你的PATH中有'node'嗎?我認爲它在/ usr/local/bin中,但可能不是? – ravi

回答

0

現在已經過了幾個月,但是,node.js更新爲0.8.22,並且已經糾正了這個問題。

如果您不想爲這個程序安裝Macports,首選的方法是下載Mac OSX安裝程序包。