admin管理员组文章数量:1487745
npm安装提示‘current user ("nobody") does not have permission to access the dev dir XXX’
在mac系统中,全局安装npm模块时,出现类似下面的报错
代码语言:javascript代码运行次数:0运行复制gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/root/.cache/node-gyp/14.18.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@tencent/xdc-cli/node_modules/@tencent/svrkit-core/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@tencent/xdc-cli/node_modules/@tencent/svrkit-core/.node-gyp'
gyp ERR! System Linux 5.4.241-1-tlinux4-0017.1
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/@tencent/xdc-cli/node_modules/@tencent/svrkit-core
gyp ERR! node -v v14.18.0
gyp ERR! node-gyp -v v5.1.0
尝试切换命令行身份 sudo -s
或者在安装命令行前面添加sudo依然无效。
出现这个问题的根本原因是因为当前安装的npm包有其他的读写系统文件的操作,但是这些操作并不是以root
身份执行的,所以就会出现权限不够的问题。
针对这个问题,npm官方已经给出了解决方案,使用下面的命令把npm user的权限设为root即可:
npm -g config set user root
本文标签: npm安装提示current user (ampquotnobodyampquot) does not have permission to access the dev dir XXX’
版权声明:本文标题:npm安装提示‘current user ("nobody") does not have permission to access the dev dir XXX’ 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/shuma/1754728941a3178882.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论