GiveToken / GiftBox

Repository for Sizzle
0 stars 0 forks source link

Bower needs administrator privileges #1106

Closed shreydesai closed 8 years ago

shreydesai commented 8 years ago

There's an error with bower on Mac OS X where bower install doesn't work. It requires administrator privileges to install some files.

/usr/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:54
                throw err;
                ^

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

    at Error (native)
    at Object.fs.openSync (fs.js:634:18)
    at Object.fs.readFileSync (fs.js:502:33)
    at Object.create.all.get (/usr/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:35:26)
    at Object.Configstore (/usr/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:28: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:541:32)
    at Object.Module._extensions..js (module.js:550:10)

It's also not super black and white – adding sudo to the command yields this error:

bower ESUDO         Cannot be run with sudo

Additional error details:
Since bower is a user command, there is no need to execute it with superuser permissions.
If you're having permission errors when using bower without sudo, please spend a few minutes learning more about how your system should work and make any necessary repairs.

http://www.joyent.com/blog/installing-node-and-npm
https://gist.github.com/isaacs/579814

You can however run a command with sudo using --allow-root option

But, adding the --allow-root flag to the command works, so this should be in the README if anyone runs into these troubles.