Gusti Arya
Gusti Arya

Reputation: 1301

EACESS error when executing Bower

I'm trying to set up Polymer project using Bower.

I am successfully installed Nodejs and Bower, but when I am tried to execute

   init bower

in the command line, I always get this error

Stack trace:
Error: EACCES, open '/kuda/bower.json'

Console trace:
Trace
at StandardRenderer.error (/usr/lib/node_modules/bower/lib/renderers/StandardRenderer.js:82:17)
at Logger.<anonymous> (/usr/lib/node_modules/bower/bin/bower:110:22)
at Logger.emit (events.js:95:17)
at Logger.emit (/usr/lib/node_modules/bower/node_modules/bower-logger/lib/Logger.js:29:39)
at /usr/lib/node_modules/bower/lib/commands/index.js:40:20
at _rejected (/usr/lib/node_modules/bower/node_modules/q/q.js:797:24)
at /usr/lib/node_modules/bower/node_modules/q/q.js:823:30
at Promise.when (/usr/lib/node_modules/bower/node_modules/q/q.js:1035:31)
at Promise.promise.promiseDispatch (/usr/lib/node_modules/bower/node_modules/q/q.js:741:41)
at /usr/lib/node_modules/bower/node_modules/q/q.js:557:44

Upvotes: 0

Views: 168

Answers (1)

Luc Hendriks
Luc Hendriks

Reputation: 2533

You don't have permission to go to /usr/lib/node_modules/..., so this is a permission problem.

A fool would now try sudo -E bower init --allow-root but that's not really a solution (although it works). Do not do this if you do not know exactly what it does and what the risks are, that counts for all sudo commands. 'Just sudo when it doesn't work' is really not a good solution.

You probably ran sudo npm install -g bower when you installed bower, because without sudo it didn't work. When that happens, the owner of the bower program is not you, but the root user and thus you have no access to it.

Try this:

  1. Delete bower
  2. Follw this post: https://stackoverflow.com/a/21712034/4269144
  3. Do npm install -g bower, without sudo!
  4. Try init bower again

Upvotes: 1

Related Questions