1

I am installing bower using the following command...

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.

I then run the following to install an Angular timer...

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. How can I solve this predicament?

Erik Åsland
  • 9,542
  • 10
  • 30
  • 58
  • 1
    Set the permissions on the files. Bower writes files, so it needs permission to write and read in the directory [this may help](https://github.com/Polymer/web-component-tester/issues/168) – Sterling Archer Feb 16 '16 at 21:59
  • @SterlingArcher Thanks. Those permissions didn't work, but you lead me down the right path. I had to change the permissions of my whole `bower` file in `/home/user/.cache/bower` – Erik Åsland Feb 16 '16 at 22:09

1 Answers1

0

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.

Usually bower is installed locally in your project directory and does not need root access.

cheers!