通过终端

时间:2015-09-24 18:50:38

标签: node.js terminal karma-runner

我输入npm install -g karma并在每次尝试时获得以下结果:

npm ERR! tar.unpack untar error /Users/Sasha/.npm/karma/0.13.10/package.tgz
npm ERR! Darwin 14.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "karma"
npm ERR! node v4.1.1
npm ERR! npm  v2.14.4
npm ERR! path /usr/local/lib/node_modules/karma
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir

npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/karma'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/karma']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
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!    [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:35:25',
npm ERR!      '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:47:53',
npm ERR!      'FSReqWrap.oncomplete (fs.js:82:15)' ] }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Sasha/npm-debug.log

请帮助!无法继续我的教程书!

1 个答案:

答案 0 :(得分:0)

这是权限错误。以root用户身份运行该命令(正如错误中明确指出的那样):

sudo npm install -g karma