2013-06-02 95 views
2

安裝咖啡腳本我試圖通過以下命令安裝咖啡腳本:麻煩我的MacBook

npm -g install 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.6.2.tgz 
npm http 200 https://registry.npmjs.org/coffee-script/-/coffee-script-1.6.2.tgz 
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/coffee-script' 
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/coffee-script'] 
npm ERR! errno: 3, 
npm ERR! code: 'EACCES', 
npm ERR! path: '/usr/local/lib/node_modules/coffee-script', 
npm ERR! fstream_type: 'Directory', 
npm ERR! fstream_path: '/usr/local/lib/node_modules/coffee-script', 
npm ERR! fstream_class: 'DirWriter', 
npm ERR! fstream_stack: 
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23', 
npm ERR!  '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53', 
npm ERR!  'Object.oncomplete (fs.js:107:15)' ] } 
npm ERR! 
npm ERR! Please try running this command again as root/Administrator. 

npm ERR! System Darwin 12.3.0 
npm ERR! command "node" "/usr/local/bin/npm" "-g" "install" "coffee-script" 
npm ERR! cwd /Users/cinker 
npm ERR! node -v v0.10.9 
npm ERR! npm -v 1.2.24 
npm ERR! path /usr/local/lib/node_modules/coffee-script 
npm ERR! fstream_path /usr/local/lib/node_modules/coffee-script 
npm ERR! fstream_type Directory 
npm ERR! fstream_class DirWriter 
npm ERR! code EACCES 
npm ERR! errno 3 
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/coffee-script' 
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23 
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53 
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15) 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  /Users/cinker/npm-debug.log 
npm ERR! not ok code 0 

然後我想在sudo的模式來使用NPM爲了覆蓋以前的安裝,但終端控制檯用不同的詞語再次警告。

npm http GET https://registry.npmjs.org/coffee-script 
npm http 304 https://registry.npmjs.org/coffee-script 
/usr/local/bin/coffee -> /usr/local/lib/node_modules/coffee-script/bin/coffee 
/usr/local/bin/cake -> /usr/local/lib/node_modules/coffee-script/bin/cake 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 

當我執行咖啡腳本,它的工作原理。但是,當我運行蛋糕時會看到錯誤。

所以我的問題是: 1.我在安裝過程中出現了什麼問題? 2.我可以刪除咖啡腳本並重新安裝嗎? 3.有沒有其他方法可以做到這一點?(我嘗試過自制軟件,但失敗了)?

非常感謝!

+0

當你運行「蛋糕」時,你會看到什麼樣的錯誤?看到「找不到Cakefile」是正常的。 'cake'需要一個Cakefile來運行。參見[蛋糕文檔](http://coffeescript.org/#cake)。 「無儲存庫字段」警告是沒有問題的。他們只是指出了不完美的軟件包元數據。 –

回答

1
  • 作爲suggested by Isaac,你也可以這樣做,然後安裝咖啡作爲一個全球性的模塊:

sudo chown -R $USER /usr/local

  • 是的,你可以去除咖啡腳本安裝無任何傷害。
  • Npm是安裝咖啡的好方法,請嘗試重新安裝。
1

我建議:

sudo npm -g install coffee-script 

這將保持在機智在/ usr/local目錄的安全性,而在同一時間提供系統的用戶權限-execute-無需改變所有權/ usr/local給一個用戶。