2013-04-12 50 views
4

我在我的機器上運行節點的版本v0.8.18,並且我試圖安裝Karma(Testacular),但不斷收到以下錯誤。我無法理解錯誤,有沒有人遇到過這種情況或知道錯過了什麼?安裝Karma(Testacular)時出錯

ruby-2.0.0-p0 AngularTut marty$ npm install -g karma 
npm http GET https://registry.npmjs.org/karma 
npm http 304 https://registry.npmjs.org/karma 
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/karma' 
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/karma'] 
npm ERR! errno: 3, 
npm ERR! code: 'EACCES', 
npm ERR! path: '/usr/local/lib/node_modules/karma', 
npm ERR! fstream_type: 'Directory', 
npm ERR! fstream_path: '/usr/local/lib/node_modules/karma', 
npm ERR! fstream_class: 'DirWriter', 
npm ERR! fstream_stack: 
npm ERR! [ 'DirWriter._create (/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:297: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" "install" "-g" "karma" 
npm ERR! cwd /Users/marty/Web/AngularTut 
npm ERR! node -v v0.8.18 
npm ERR! npm -v 1.2.2 
npm ERR! path /usr/local/lib/node_modules/karma 
npm ERR! fstream_path /usr/local/lib/node_modules/karma 
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/karma' 
npm ERR! fstream_stack DirWriter._create (/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:297:15) 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  /Users/marty/Web/AngularTut/npm-debug.log 
npm ERR! not ok code 0 

回答

11

add sudo在命令前面。

sudo npm install -g karma 
+0

這對我不起作用。同樣的錯誤。還有其他建議嗎?謝謝。 –

+0

@ U-L您安裝了哪個版本的節點? – FluxEngine

+0

$ node --version v0.8.17 –