2012-02-20 150 views
1

我試圖在Mac OS X Lion上使用express框架。有這些問題:錯誤在Mac OS X Lion上安裝[email protected]

SilverFir-2:Node mike$ sudo curl http://npmjs.org/install.sh | sh 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
           Dload Upload Total Spent Left Speed 
100 7881 100 7881 0  0 29556  0 --:--:-- --:--:-- --:--:-- 43541 
tar=/usr/bin/tar 
version: 
bsdtar 2.8.3 - libarchive 2.8.3 
install [email protected] 
fetching: http://registry.npmjs.org/npm/-/npm-1.1.1.tgz 
0.6.1 
1.1.1 
cleanup prefix=/usr/local 

All clean! 
npm ERR! Could not create /usr/local/lib/node_modules/___npm.npm 
npm ERR! error installing [email protected] 

npm ERR! Error: EACCES, permission denied '/usr/local/lib/node_modules' 
npm ERR! 
npm ERR! Please try running this command again as root/Administrator. 
npm ERR! 
npm ERR! System Darwin 11.3.0 
npm ERR! command "/usr/local/bin/node" "/private/var/folders/6x/frvx23td327frc2z_hgl12sc0000gn/T/npm.3230/package/cli.js" "install" "-gf" 
npm ERR! cwd /private/var/folders/6x/frvx23td327frc2z_hgl12sc0000gn/T/npm.3230/package 
npm ERR! node -v v0.6.1 
npm ERR! npm -v 1.1.1 
npm ERR! path /usr/local/lib/node_modules 
npm ERR! code EACCES 
npm ERR! message EACCES, permission denied '/usr/local/lib/node_modules' 
npm ERR! errno {} 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  /private/var/folders/6x/frvx23td327frc2z_hgl12sc0000gn/T/npm.3230/package/npm-debug.log 
npm not ok 
It failed 

節點版本v0.6.1。

我環顧網絡,大部分答案都來自節點0.4天,他們都只是說升級。它看起來像我比較最新的比以前的問題...

回答

7

當你這樣做:

sudo curl http://npmjs.org/install.sh | sh 

您將運行curlroot,但sh作爲當前用戶。你應該這樣做:

curl http://npmjs.org/install.sh | sudo sh 

而且一切都會好的。

+0

謝謝 - 像魅力一樣工作。 – 2012-04-13 18:54:39