简体   繁体   English

Ubuntu:错误:EACCES,使用bower安装时权限被拒绝错误

[英]Ubuntu: Error: EACCES, permission denied error while using bower to install

I am installing bower using the following command... 我正在使用以下命令安装bower ...

sudo npm install -g bower

and get the following... 并获得以下内容...

npm http GET https://registry.npmjs.org/bower
npm http 304 https://registry.npmjs.org/bower
/usr/local/bin/bower -> /usr/local/lib/node_modules/bower/bin/bower
bower@1.7.7 /usr/local/lib/node_modules/bower

I believe Bower to have been installed successfully using NPM . 我相信Bower已使用NPM成功安装。

I then run the following to install an Angular timer... 然后,我运行以下命令安装Angular计时器...

bower install angular-timer

And get the following error ridden traceback... 并获得以下错误处理回溯...

Error: EACCES, permission denied '/home/alopex/.config/configstore/bower-github.yml'
You don't have access to this file.

at Object.fs.openSync (evalmachine.<anonymous>:432:18)
at Object.fs.readFileSync (evalmachine.<anonymous>:286:15)
at Object.create.all.get (/usr/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:34:29)
at Object.Configstore (/usr/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:27:44)
at readCachedConfig (/usr/local/lib/node_modules/bower/lib/config.js:19:23)
at defaultConfig (/usr/local/lib/node_modules/bower/lib/config.js:11:12)
at Object.<anonymous> (/usr/local/lib/node_modules/bower/lib/index.js:16:32)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)

I would try to just use sudo , but I know from looking around Stack Overflow and the Bower site that Bower is not made to be run using sudo . 我会尝试仅使用sudo ,但是我从Stack Overflow和Bower站点周围了解到,Bower并不是使用sudo运行的。 How can I solve this predicament? 我该如何解决这一困境?

First do the following. 首先执行以下操作。

 sudo bower install --allow-root

Then run the following in terminal 然后在终端中运行以下命令

 bower install

Sometimes it shows error even if all the packages included in the bower.json file is successfully installed. 即使成功安装了bower.json文件中包含的所有软件包,有时也会显示错误。

Usually bower is installed locally in your project directory and does not need root access. 通常,Bower本地安装在您的项目目录中,不需要root访问。

cheers! 干杯!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM