我输入"npm install -g yo"就会出现如下报错。 我输入“npm install yo”就不会报错,但是再输入“yo -v”,缺看不到版本号,而是“-bash: yo: command not found”
报错文件如下:求前辈帮忙~ EricdeMacBook-Pro:~ eric$ npm install -g yo npm ERR! tar.unpack untar error /Users/eric/.npm/yo/1.4.6/package.tgz npm ERR! Darwin 14.1.0 npm ERR! argv “node” “/usr/local/bin/npm” “install” “-g” "yo" npm ERR! node v0.12.0 npm ERR! npm v2.5.1 npm ERR! path /usr/local/lib/node_modules/yo npm ERR! code EACCES npm ERR! errno -13
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/yo’ npm ERR! at Error (native) npm ERR! { [Error: EACCES, mkdir ‘/usr/local/lib/node_modules/yo’] npm ERR! errno: -13, npm ERR! code: ‘EACCES’, npm ERR! path: ‘/usr/local/lib/node_modules/yo’, npm ERR! fstream_type: ‘Directory’, npm ERR! fstream_path: ‘/usr/local/lib/node_modules/yo’, 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:46:53’, npm ERR! ‘FSReqWrap.oncomplete (fs.js:99: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/eric/npm-debug.log
sudo执行
@nanablast 不明白,求详解~
sudo npm install -g yo
这样应该就可以了吧,希望你用的电脑不是windows。。。
@CocaCola183 恩,yeoman装好了,谢谢,往后装其他组件,也要加sudo吗?
@Grizzly-Eric 要么加上sudo
全局安装,要么去掉-g
把模块安装到当前目录
全局安装的时候是在root目录下的安装的,root目录下做文件操作都需要root权限 所以 需要加上sudo 所以养成在linux下sudo npm install 比较好
我用了sudo 还是失败 我没有用-g。
npm ERR! tar.unpack untar error /Users/guods/.npm/folio/0.3.4/package.tgz