node.js - npm 安装 bower 时出错。
天蓬老师
天蓬老师 2017-04-17 14:36:45
0
3
563

以下是命令和报错:

首先我直接按照官方文档进行安装:
[glenn@centos7 imooc]$ npm install bower -g
npm ERR! tar.unpack untar error /home/glenn/.npm/bower/1.7.9/package.tgz
npm ERR! Linux 3.10.0-327.22.2.el7.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "bower" "-g"
npm ERR! node v4.4.7
npm ERR! npm v2.15.8
npm ERR! path /usr/local/lib/node_modules/bower
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/bower'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/bower']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/bower',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/bower',
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! /home/glenn/Web/nodejs/imooc/npm-debug.log

嗯 根据提示可能是权限问题,所以
[glenn@centos7 imooc]$ sudo npm install bower -g
[sudo] password for glenn:
sudo: npm: command not found
然而不行,我看了下路径
[glenn@centos7 imooc]$ whereis npm
npm: /usr/local/bin/npm

然后我 google 了一下,似乎没人遇到这个问题。

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

모든 응답(3)
刘奇

试试sudo /usr/local/bin/npm install bower -g

阿神

设置一下NODE_PATH试试;

阿神

权限问题 加上sudo

최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿