npm install报错 Error: EACCES: permission denied
Posted yechen2019
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了npm install报错 Error: EACCES: permission denied相关的知识,希望对你有一定的参考价值。
报错内容
Unable to save binary /root/packageadmin/spring-boot-admin-2.1.6/spring-boot-admin-server-ui/node_modules/node-sass/vendor/linux-x64-64 : { Error: EACCES: permission denied, mkdir '/root/packageadmin/spring-boot-admin-2.1.6/spring-boot-admin-server-ui/node_modules/node-sass/vendor'
at Object.mkdirSync (fs.js:753:3)
at sync (/root/packageadmin/spring-boot-admin-2.1.6/spring-boot-admin-server-ui/node_modules/mkdirp/index.js:71:13)
at Function.sync (/root/packageadmin/spring-boot-admin-2.1.6/spring-boot-admin-server-ui/node_modules/mkdirp/index.js:77:24)
at checkAndDownloadBinary (/root/packageadmin/spring-boot-admin-2.1.6/spring-boot-admin-server-ui/node_modules/node-sass/scripts/install.js:114:11)
at Object.<anonymous> (/root/packageadmin/spring-boot-admin-2.1.6/spring-boot-admin-server-ui/node_modules/node-sass/scripts/install.js:157:1)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
errno: -13,
syscall: 'mkdir',
code: 'EACCES',
path:
'/root/packageadmin/spring-boot-admin-2.1.6/spring-boot-admin-server-ui/node_modules/node-sass/vendor' }
原因
没有配置nodejs的npm-global全局path
解决方式
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
#编辑profile文件,在文件末尾加入内容:export PATH=~/.npm-global/bin:$PATH
vi /etc/profile
# 使资源文件重新生效
source /etc/profile
然后重新执行npm install即可
以上是关于npm install报错 Error: EACCES: permission denied的主要内容,如果未能解决你的问题,请参考以下文章
npm install 报错(npm ERR! errno -4048,Error: EPERM: operation not permitted,)解决方法
npm install 报错(npm ERR! errno -4048,Error: EPERM: operation not permitted,)解决方法
npm install 报错(npm ERR! errno -4048,Error: EPERM: operation not permitted,)解决方法
linux 下 root 权限执行 npm install 报错:Error:EACCES:permission denied ‘xxx‘?
npm install 报错:verbose stack Error: unable to resolve dependency tree
npm install 安装一直报错Error EPERM operation not permitted, mkdir