首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >使用bower安装时出现权限错误

使用bower安装时出现权限错误
EN

Stack Overflow用户
提问于 2015-04-25 21:38:08
回答 4查看 26.1K关注 0票数 17

每次我尝试用Bower安装一些东西时,我都会得到一个权限错误,如下所示:

Andreass-MacBook-Air:openMedia Andreas$ bower install jquery
/usr/local/lib/node_modules/bower/node_modules/configstore/index.js:56
            throw err;
                  ^
Error: EACCES, permission denied '/Users/Andreas/.config/configstore/bower-github.yml'
You don't have access to this file.

at Error (native)
at Object.fs.openSync (evalmachine.<anonymous>:500:18)
at Object.fs.readFileSync (evalmachine.<anonymous>:352:15)
at Object.create.all.get (/usr/local/lib/node_modules/bower/node_modules/configstore/index.js:34:29)
at Object.Configstore (/usr/local/lib/node_modules/bower/node_modules/configstore/index.js:27:44)
at readCachedConfig (/usr/local/lib/node_modules/bower/lib/config.js:22:23)
at defaultConfig (/usr/local/lib/node_modules/bower/lib/config.js:11:24)
at Object.<anonymous> (/usr/local/lib/node_modules/bower/lib/index.js:40:32)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
Andreass-MacBook-Air:openMedia Andreas$ 

我想可能会有一个简单的解决方案。但这是我第一次使用Bower。提前谢谢。

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2015-04-25 21:40:39

尝试过sudo?

sudo bower install --allow-root
sudo bower install jquery

另一种解决方案是更改configstore文件夹的chown

sudo chown -R Andreas:Andreas /Users/Andreas/.config/configstore/
bower init
bower install jquery

如果eaccess有更多错误,请将chown展开到整个主文件夹

票数 53
EN

Stack Overflow用户

发布于 2016-06-14 11:12:47

下面是修复方法,运行以下命令。应该能行得通。

sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
票数 17
EN

Stack Overflow用户

发布于 2016-10-06 16:53:56

更改json bower配置文件.bowerrc,如下所示

{
    "directory": "www/lib"
}

看起来像

{
    "directory": "www/lib",
    "allow_root": true
}
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29865913

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档