Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Ubuntu上的Bower问题_Node.js_Task_Bower - Fatal编程技术网

Node.js Ubuntu上的Bower问题

Node.js Ubuntu上的Bower问题,node.js,task,bower,Node.js,Task,Bower,目前在Ubuntu上使用Bower存在问题 我尝试使用bower install、bower init,建议不要使用sudo,但当我使用时,会出现以下错误 bower EACCES EACCES:权限被拒绝,打开“/var/www/xxxxxx/html/wp content/themes/xxxxxxxx/bower.json” 堆栈跟踪: 错误:EACCES:权限被拒绝,打开“/var/www/xxxxxx/html/wp content/themes/xxxxxxxx/bower.json

目前在Ubuntu上使用Bower存在问题

我尝试使用bower install、bower init,建议不要使用sudo,但当我使用时,会出现以下错误

bower EACCES EACCES:权限被拒绝,打开“/var/www/xxxxxx/html/wp content/themes/xxxxxxxx/bower.json”

堆栈跟踪: 错误:EACCES:权限被拒绝,打开“/var/www/xxxxxx/html/wp content/themes/xxxxxxxx/bower.json” 错误(本机)

控制台跟踪: 错误 位于StandardRenderer.error(/usr/local/lib/node_modules/bower/lib/renderers/StandardRenderer.js:81:37) 在Logger。(/usr/local/lib/node_modules/bower/lib/bin/bower.js:110:26) 在emitOne(events.js:77:13) 在Logger.emit(events.js:169:7) 在Logger.emit(/usr/local/lib/node_modules/bower/lib/node_modules/bower Logger/lib/Logger.js:29:39) at/usr/local/lib/node_modules/bower/lib/commands/index.js:48:20 at_被拒绝(/usr/local/lib/node_modules/bower/lib/node_modules/q/q.js:844:24) at/usr/local/lib/node_modules/bower/lib/node_modules/q/q.js:870:30 at Promise.when(/usr/local/lib/node_modules/bower/lib/node_modules/q/q.js:1122:31) 在Promise.Promise.dispatch(/usr/local/lib/node_modules/bower/lib/node_modules/q/q.js:788:41) 系统信息: 鲍尔版本:1.7.9 节点版本:4.2.6 操作系统:Linux 4.4.0-36-generic x64

唯一有效的方法是下面的
sudobower安装--allowroots


有什么办法可以解决这个问题吗?

您必须拥有对试图安装文件的目录的权限。因此,您必须使用bower作为有权访问此文件夹的用户(例如Ubuntu上的
www-data
sudo-u www-data-bower-install