47

I've read a few answers on StackOverflow & some other sites but none seem to fix the issue I'm having.

I'm installing AppGyver Add-ons, via terminal. Getting the following error:

BradMacBookPro:SparksInSpain breadadams$ bower install https://##MY-DOWNLOAD-CODE##@addons.appgyver.com/steroids-addons.js?version=3.1.0 --save
bower not-cached    https://##MY-DOWNLOAD-CODE##@addons.appgyver.com/steroids-addons.js?version=3.1.0#*
bower resolve       https://##MY-DOWNLOAD-CODE##@addons.appgyver.com/steroids-addons.js?version=3.1.0#*
bower download      https://##MY-DOWNLOAD-CODE##@addons.appgyver.com/steroids-addons.js?version=3.1.0
bower EACCES        EACCES, mkdir '/Users/breadadams/.cache/bower/packages/7480e059b318750565b4b25c2556c9c4'

Stack trace:
Error: EACCES, mkdir '/Users/breadadams/.cache/bower/packages/7480e059b318750565b4b25c2556c9c4'

Console trace:
Trace
    at StandardRenderer.error (/usr/local/lib/node_modules/bower/lib/renderers/StandardRenderer.js:74:17)
    at Logger.updateNotifier.packageName (/usr/local/lib/node_modules/bower/bin/bower:109:18)
    at Logger.EventEmitter.emit (events.js:95:17)
    at Logger.emit (/usr/local/lib/node_modules/bower/node_modules/bower-logger/lib/Logger.js:29:39)
    at /usr/local/lib/node_modules/bower/lib/commands/install.js:27:16
    at _rejected (/usr/local/lib/node_modules/bower/node_modules/q/q.js:808:24)
    at /usr/local/lib/node_modules/bower/node_modules/q/q.js:834:30
    at Promise.when (/usr/local/lib/node_modules/bower/node_modules/q/q.js:1079:31)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/bower/node_modules/q/q.js:752:41)
    at /usr/local/lib/node_modules/bower/node_modules/q/q.js:574:44

System info:
Bower version: 1.2.8
Node version: 0.10.25
OS: Darwin 13.1.0 x64

I'm not sudo, I've tried --allow-root, cleaned the bower cache, always get the same error on install. Some local permission problem?

Brad Adams
  • 2,066
  • 4
  • 29
  • 38

8 Answers8

134

I had a similar issue that I couldn't resolve using these suggestions. I was successful when I ran Bower with root privileges, like so:

sudo bower install --allow-root
Chris Seymour
  • 83,387
  • 30
  • 160
  • 202
JoelPrz
  • 1,404
  • 1
  • 10
  • 3
  • 2
    If this worked, then you have a permissions issue. Using the chown command as others have specified below will actually fix the error. You can navigate to /Users//.config/configstore and use "ls -l" to check ownership. If any of those files are owned by root, that is likely what is causing the issue. This is where you use "sudo chown -R .config/" (assuming you're in the same directory as the .config dir) to change the user ownership. Check similarly on the ~/.cache directory – Nick Brady Feb 11 '16 at 00:04
  • After that command I suggest (as suggested below) to run: `$ sudo chown YOUUSERNAME:staff ~/.config/configstore/bower-github.json ~/.config/configstore/update-notifier-bower.json` – aemonge Sep 16 '16 at 15:16
  • I tried the first comment and my user owns the file and the group is staff. How do I fix this issue for the future? – RyanCameron.Me Nov 27 '16 at 17:31
  • Changing the permissions as stated below is the proper fix for this I think. – PlunkettBoy Nov 13 '17 at 19:44
43

Change the ownership for the .config and cache directory

sudo chown -R username:username ~/.config 

and

sudo chown -R username:username ~/.cache
Kannan S
  • 2,459
  • 1
  • 17
  • 17
  • 2
    I used yours but modified. sudo chown -R username ~/.config sudo chown -R username ~/.cache without the extra ":username" and mine worked. What is the purpose of the :username? – Tyler Davis Jun 12 '15 at 20:58
  • 4
    This is a good solution. Thanks. You can also use the user alias: sudo chown -R $USER ~/.config AND sudo chown -R $USER ~/.cache. – Liko Jul 09 '15 at 18:53
  • 1
    @TylerDavis it is specified like username:usergroup where usergroup may have many users. but by default there is not usergroup is created hence your command worked. – Zeel Shah Aug 13 '15 at 16:19
  • 1
    I had inadvertently installed bower and npm as root, and have not been able to run them without sudo/--allow-root for a long, long time. This fixed it for me, thank you very much. – Ryan Sep 24 '15 at 18:29
  • @Tyler Davis you have saved my day! – rcat24 Nov 18 '15 at 15:37
35

I noticed you tried this from a MacBook Pro.

You could try this:

  • go to the finder
  • under menu go Go To Folder type this: ~/.cache/bower
  • delete its content and try again.

Also as @Edwin suggested you may try:

The command bower cache clean which will have the same effect irrespective of OS.

Dalorzo
  • 19,834
  • 7
  • 55
  • 102
  • Thanks, I was facing a similar problem while using Ember-CLI, where the installation stopped because bower failure to rename tmp directories. Did as you suggested, and everything worked fine. Thanks again :) – Vageesh Bhasin Jun 28 '14 at 04:41
  • 4
    Alternatively the command `bower cache clean` will have the same effect irrespective of OS. – Edwin Dalorzo Aug 07 '14 at 13:46
  • `bower cache clean` was still throwing errors, had to `cd` to the cache folder and delete manually. – Christopher Marshall May 05 '15 at 16:45
  • Same problem as Christopher, removing the directory was required for me. Strange as `bower cache clean` has worked for me in the past, but I've since updated a lot so maybe bower has changed in that respect. – Eric Soyke Aug 17 '16 at 18:57
10

Im not sure what happened with my project but in order to fix the issues with bower I had to run the following.

sudo npm install -g bower

sudo bower cache clean --allow-root 

rm -Rf bower_components

sudo bower install --allow-root

Im still not really sure what went wrong but after those commands i was up and running

Chris Seymour
  • 83,387
  • 30
  • 160
  • 202
CodeGuyRoss
  • 786
  • 1
  • 10
  • 23
  • I have tried everything above and only this fixed for me! Much appreciated! P.S. Why does this happen? My working project just broke suddenly. I have not made any changes ... – MadPhysicist Jul 09 '16 at 01:44
6

1) run

$groups

to get the name of your group

2) then run

$sudo chown -R {user}:{group} ~/.config 
$sudo chown -R {user}:{group} ~/.cache

where {user} - is username and {group} - is group name

Renat Gatin
  • 6,053
  • 5
  • 37
  • 58
4

I hit the same thing and noticed that the bower_components folder was owned by the root user. I changed ownership to my user and everything worked without having to run bower as root.

sudo chown -R $USER bower_components
dangw
  • 41
  • 1
3

Like everyone says, bower and npm shouldn't be run with sudo. This corrected the problem for me on my OSX machine.

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

Now you should be able to run:

npm install
npm start 

and even

bower install

without having to use sudo.

*note npm start usually calls bower install

goopcat
  • 105
  • 1
  • 8
0

I had the same issue but nothing above worked for me. If you recently updated Xcode and don't recognize, don't forget to agree the terms and install the command line tools!

xcode-select --install

Florian
  • 1,182
  • 8
  • 10