我在Ubuntu 16.04上部署一个Angular项目,使用sudo npm install运行时出现了以下错误(如果不用sudo,则无法工作)。看起来npm没有安装的权限。我最近更新了nodejs到8.11.4,但仍然有同样的错误,因此显然不是版本问题。如何为它提供正确的权限?
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/var/www/project_name/node_modules/node-sass/build'
gyp ERR! System Linux 4.4.0-1065-aws
gyp ERR! command "/usr/local/bin/node" "/var/www/project_name/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "-libsass_library="
gyp ERR! cwd /var/www/front-stormsensor/node_modules/node-sass
gyp ERR! node -v v8.11.4
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
我的项目有问题吗?还是安装有误?不确定下一步该怎么做,谢谢
sudo
命令运行该命令。例如:sudo npm install
。 - SiddAjmera