2

Im getting this error trying to install dependencies from bower.json (bower install) and i don't know what is it or how i can fix it... any help would be apreciated.

 ✘ deniz946@UbuntuOS  ~/Desktop/meanapp/client   resourcejs  bower install
/home/deniz946/.nvm/versions/node/v5.0.0/lib/node_modules/bower/lib/node_modules/configstore/index.js:54
                throw err;
                ^

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

    at Error (native)
    at Object.fs.openSync (fs.js:584:18)
    at Object.fs.readFileSync (fs.js:431:33)
    at Object.create.all.get (/home/deniz946/.nvm/versions/node/v5.0.0/lib/node_modules/bower/lib/node_modules/configstore/index.js:35:26)
    at Object.Configstore (/home/deniz946/.nvm/versions/node/v5.0.0/lib/node_modules/bower/lib/node_modules/configstore/index.js:28:44)
    at readCachedConfig (/home/deniz946/.nvm/versions/node/v5.0.0/lib/node_modules/bower/lib/config.js:19:23)
    at defaultConfig (/home/deniz946/.nvm/versions/node/v5.0.0/lib/node_modules/bower/lib/config.js:11:12)
    at Object.<anonymous> (/home/deniz946/.nvm/versions/node/v5.0.0/lib/node_modules/bower/lib/index.js:16:32)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
FridoxFL
  • 67
  • 1
  • 8
  • Order it as superuser, `sudo bower install`. – Tushar May 04 '16 at 15:28
  • 2
    You should not have to run bower with sudo. You messed up when installing it. There's a folder's permission issue for sure. – yBrodsky May 04 '16 at 15:29
  • How I can fix that permissions issue? – FridoxFL May 04 '16 at 15:32
  • @FridoxFL `sudo chown ` – nem035 May 04 '16 at 15:33
  • @nem i've did that and now im getting this error http://pastebin.com/yaZQy8d7 – FridoxFL May 04 '16 at 15:37
  • 1
    @FridoxFL you are getting a permissions issue again. Most likely your permissions problem is somewhere higher up, you might need to recursively `chown` the `.cache` folder as well but perhaps more research on this issue might show you a better way to solve this. Usually these problems arise when you install `npm` or `bower` with `sudo` when it doesn't need it and then anything they use will require `sudo` permissions as well. – nem035 May 04 '16 at 15:40
  • 1
    @nem Fixed with chown -r the .cache folder, thanks you very much! – FridoxFL May 04 '16 at 15:42

3 Answers3

6

This command should work . It provide permission to bower configration.

sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config

and also give permission to folder by

sudo chmod -R 777 foldername

.

Himanshu sharma
  • 7,487
  • 4
  • 42
  • 75
1

You are facing access permissions error. Use sudo:

sudo bower install

EDIT: sudo does not seem to be working with bower install. This works for me though:

bower install --allow-root
Mohit Bhardwaj
  • 9,650
  • 3
  • 37
  • 64
1

For a more exotic take, where you are running as root in Docker and experiencing this, one should know that NPM is running as the owner of the current working directory. So in case you are root and does not work no matter what you try, try listing the files and see if they are owned by root. If not, it will never work, unless you change the ownership to root.

See this answer for the full explanation and references to source code in NPM.

oligofren
  • 20,744
  • 16
  • 93
  • 180