nmp install websocket-bench permission denied

sudo npm install -g websocket-bench --registry=http://registry.npm.taobao.org

Error:

gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/websocket-bench/node_modules/bufferutil/build'
gyp ERR! System Linux 3.10.0-957.21.3.el7.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/websocket-bench/node_modules/bufferutil
gyp ERR! node -v v8.16.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

> [email protected] install /usr/lib/node_modules/websocket-bench/node_modules/utf-8-validate
> node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/websocket-bench/node_modules/utf-8-validate/build'
gyp ERR! System Linux 3.10.0-957.21.3.el7.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/websocket-bench/node_modules/utf-8-validate
gyp ERR! node -v v8.16.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

解决方法:

npm install 添加参数 --unsafe-perm
 

sudo npm install -g websocket-bench --registry=http://registry.npm.taobao.org --unsafe-perm

https://www.geek-share.com/detail/2758815500.html

你可能感兴趣的:(Linux—错误)