2012-03-05 121 views
1

Possible Duplicate:
error installing coffeescript on mac 10.7.2CoffeeScript使用NPM和節點安裝

此刻,我正試圖在我的計算機上安裝CoffeeScript。我有node.js版本0.6.7和npm 1.1.0-beta-10。當我運行命令npm install -g coffee-script時,它顯示這個錯誤。

npm http GET https://registry.npmjs.org/coffee-script 
npm http 200 https://registry.npmjs.org/coffee-script 
npm http GET https://registry.npmjs.org/coffee-script/-/coffee-script-1.2.0.tgz 
npm http 200 https://registry.npmjs.org/coffee-script/-/coffee-script-1.2.0.tgz 
npm ERR! Could not create /usr/local/lib/node_modules/___coffee-script.npm 
npm ERR! error installing [email protected] 
npm ERR! Error: EACCES, permission denied '/usr/local/lib/node_modules/___coffee-script.npm' 
npm ERR! Report this *entire* log at: 
npm ERR!  <http://github.com/isaacs/npm/issues> 
npm ERR! or email it to: 
npm ERR!  <[email protected]> 
npm ERR! 
npm ERR! System Darwin 11.0.1 
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "coffee-script" 
npm ERR! cwd /Users/Solomon 
npm ERR! node -v v0.6.7 
npm ERR! npm -v 1.1.0-beta-10 
npm ERR! path /usr/local/lib/node_modules/___coffee-script.npm 
npm ERR! code EACCES 
npm ERR! message EACCES, permission denied '/usr/local/lib/node_modules/___coffee-script.npm' 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  /Users/Solomon/npm-debug.log 

我該如何解決這個問題?

+0

運行它作爲根。您的用戶沒有權限寫入/ usr/local/lib/ – seppo0010 2012-03-05 00:10:48

回答

5

Error: EACCES, permission denied '/usr/local/lib/node_modules/___coffee-script.npm'

這意味着你沒有訪問權限,因此以root身份運行

$ sudo npm install -g coffee-script

(積分爲或者不使用CoffeeScript的(這是一個可怕的事情))

+2

不同意答案的反CoffeeScript部分,但注意其餘部分。 – 2012-03-05 02:41:22

+0

@TrevorBurnham在我們失去javascript之前,有人要打好戰鬥:( – Raynos 2012-03-05 03:26:43

+0

coffeescript是javascript。另外,我的問題是咖啡腳本的名稱改爲「coffee-script」而不是一個單詞。 – rncrtr 2013-10-30 16:53:50

1

permission denied部分是你的暗示,安裝程序需要它沒有的權限。嘗試作爲root運行,即

sudo npm install coffee-script