'bower install' fails with EACCES: permission denied



First noticed April 1st @ 6:45am MST, my CircleCI builds began to fail with “permission denied” errors when performing a bower install command:

cd frontend && bower install
                    throw err0;

Error: EACCES: permission denied, mkdir '/home/ubuntu/.config/configstore'
    at Error (native)
    at Object.fs.mkdirSync (fs.js:842:18)
    at Function.sync (/opt/circleci/nodejs/v5.5.0/lib/node_modules/bower/lib/node_modules/mkdirp/index.js:70:13)
    at Object.create.all.get (/opt/circleci/nodejs/v5.5.0/lib/node_modules/bower/lib/node_modules/configstore/index.js:41:13)
    at Object.Configstore (/opt/circleci/nodejs/v5.5.0/lib/node_modules/bower/lib/node_modules/configstore/index.js:27:44)
    at readCachedConfig (/opt/circleci/nodejs/v5.5.0/lib/node_modules/bower/lib/config.js:19:23)
    at defaultConfig (/opt/circleci/nodejs/v5.5.0/lib/node_modules/bower/lib/config.js:11:12)
    at Object.<anonymous> (/opt/circleci/nodejs/v5.5.0/lib/node_modules/bower/lib/index.js:16:32)
    at Module._compile (module.js:413:34)

I’m using the Ubuntu 14.04 (Trusty) OS for my builds, and this build worked fine multiple times yesterday. I’ve tried this build with and without a clean cache.

Update #1: The cause of this appears to be that the ~ubuntu/.config directory is pre-existing and owned by root.

ubuntu@box213:~$ ls -ld ~/.config
drwxr-xr-x 1 root root 12 Mar 31 02:47 /home/ubuntu/.config

Update #2: As a workaround, I’m adding sudo chown ubuntu:ubuntu ~/.config to my circle.yml pre-dependency command. Seems to “address” the issue.

    version: 5.5.0

    - sudo chown ubuntu:ubuntu ~/.config
    - cd frontend && bower install


I can also confirm we’ve just started seeing the same issue.

Thanks for the fix @mfenniak. We’re also running into problems installing apt packages from a custom source

sudo add-apt-repository ppa:beineri/opt-qt551-trusty -y returned exit code 1


Thanks for reporting this and apologies for the slow reply. I’ve just checked and default permission for ~/.config should now be fixed on 14.04:

ubuntu@box1162:~/.config$ ls -ld ~/.config
drwxr-xr-x 1 ubuntu root 34 May  5 09:48 /home/ubuntu/.config

bower install commands run successfully on my test build without the workaround. Let us know if that’s not the case with your builds.