在OSX上安装Yeoman

时间:2015-08-26 00:03:57

标签: node.js macos yeoman asp.net-core dnx

我在OSX上使用ASP.NET 5设置Visual Studio Code但在安装Yeoman时出错。我使用以下命令。

npm install -g yo grunt-cli generator-aspnet bower

并收到这些错误

npm ERR! tar.unpack untar error /Users/username/.npm/grunt-cli/0.1.13/package.tgz
npm ERR! tar.unpack untar error /Users/username/.npm/generator-aspnet/0.0.60/package.tgz
npm ERR! tar.unpack untar error /Users/username/.npm/yo/1.4.7/package.tgz
npm ERR! Darwin 14.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "yo" "grunt-cli" "generator-aspnet" "bower"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! path /usr/local/lib/node_modules/grunt-cli
npm ERR! code EACCES
npm ERR! errno -13

npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/grunt-cli'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES, mkdir '/usr/local/lib/node_modules/grunt-cli']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules/grunt-cli',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: '/usr/local/lib/node_modules/grunt-cli',
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:95:15)' ] }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EACCES, rmdir '/usr/local/lib/node_modules/bower'
npm ERR! error rolling back     at Error (native)
npm ERR! error rolling back  { [Error: EACCES, rmdir '/usr/local/lib/node_modules/bower']
npm ERR! error rolling back   errno: -13,
npm ERR! error rolling back   code: 'EACCES',
npm ERR! error rolling back   path: '/usr/local/lib/node_modules/bower' }

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

如何在没有这些错误的情况下回滚和安装

1 个答案:

答案 0 :(得分:3)

您需要root访问权限或权限才能全局安装!

试试这个:

sudo npm install -g yo grunt-cli generator-aspnet bower