在ubuntu上安装[email protected]时出错

问题描述 投票:1回答:1

我正在尝试安装bower版本1.8.2 全球在我的ubuntu 16.04上

但它显示缺少写入访问/ usr / local / bin

我有节点4.2.6和npm 3.5.2我得到这个错误:

 ubuntu@ubuntu-Inspiron-3521:~/Desktop/Python-2.7.14$ npm install -g bower
npm WARN deprecated [email protected]: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm WARN checkPermissions Missing write access to /usr/local/lib
/usr/local/lib
`-- [email protected] 

npm ERR! Linux 4.4.0-21-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "bower"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! path /usr/local/lib
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib' }
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/ubuntu/Desktop/Python-2.7.14/npm-debug.log
ubuntu@ubuntu-Inspiron-3521:~/Desktop/Python-2.7.14$ node --version
v4.2.6
ubuntu@ubuntu-Inspiron-3521:~/Desktop/Python-2.7.14$ npm --version
3.5.2
ubuntu@ubuntu-Inspiron-3521:~/Desktop/Python-2.7.14$ 
node.js bower npm-install bower-install
1个回答
0
投票

你可以使用sudo安装它:

sudo npm i --global bower

但不建议这样做,因此您可以像这样修复您的npm权限:

sudo chown -R $(whoami) $(npm config get prefix)/lib/node_modules

你可以找到一个gist for the same here.

© www.soinside.com 2019 - 2024. All rights reserved.