【问题标题】:Error installing bower version 1.8.2 on Ubuntu在 Ubuntu 上安装 Bower 版本 1.8.2 时出错
【发布时间】:2018-08-14 10:45:49
【问题描述】:

我正在尝试安装 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 bower@1.8.2: ...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
`-- bower@1.8.2 

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】:

您可以使用 sudo 安装它:

sudo npm i --global bower

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

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

您可以找到gist for the same here.

【讨论】:

    猜你喜欢
    • 2023-03-02
    • 2015-07-11
    • 2021-10-23
    • 1970-01-01
    • 1970-01-01
    • 2015-03-03
    • 2014-03-06
    • 2014-01-05
    相关资源
    最近更新 更多