Getting “Error: EACCES, mkdir” whenever I try to install something with bower

纵饮孤独 提交于 2019-12-23 21:35:28

问题


I am trying to install bootstrap with bower. I have install bower globally with npm. But whenever I try to install bootstrap with bower I get the following error -

 Stack trace: Error: EACCES, mkdir
 '/var/www/html/edutech/dev_files/bower_components'

 Console trace: Trace
     at StandardRenderer.error (/usr/local/lib/node_modules/bower/lib/renderers/StandardRenderer.js:82:17)
     at Logger.<anonymous> (/usr/local/lib/node_modules/bower/bin/bower:110:22)
     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/index.js:40:20
     at _rejected (/usr/local/lib/node_modules/bower/node_modules/q/q.js:797:24)
     at /usr/local/lib/node_modules/bower/node_modules/q/q.js:823:30
     at Promise.when (/usr/local/lib/node_modules/bower/node_modules/q/q.js:1035:31)
     at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/bower/node_modules/q/q.js:741:41)
     at /usr/local/lib/node_modules/bower/node_modules/q/q.js:557:44

  System info: Bower version: 1.3.12 Node version: 0.10.25 OS: Linux
 3.13.0-24-generic x64

What am I doing wrong?


回答1:


One workaround, although not optimal, is to install using sudo

sudo bower install --allow-root

I'm currently facing the same problem, tried giving permissions, couldnt solve it otherwise.

Edit 1

Got to the root of the problem. You don't have access while trying to do a bower install to the folder that bower is using for its installation things.

Easiest solution:

sudo chown -R whoami /targetfolder

In your case you might as well give access to the whole 'www' folder.

What I think it's the cause, is the fact that you're trying to write as a normal user in a folder owned by another user, (in this case the administrator).



来源:https://stackoverflow.com/questions/26137043/getting-error-eacces-mkdir-whenever-i-try-to-install-something-with-bower

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!