当前位置:网站首页>Error: npm ERR code EPERM
Error: npm ERR code EPERM
2022-07-31 13:09:00 【hungry very hungry】
1 完整错误
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path D:NodeJS
ode_cache_cacache mpbbab18e
npm ERR! errno EPERM
npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/webpack: EPERM: operation not permitted, open 'D:NodeJS
ode_cache_cacache mpbbab18e'
npm ERR! at D:NodeJS
ode_modules
pm
ode_modulesminipass-fetchlibody.js:162:15
npm ERR! at async Arborist.[nodeFromEdge] (D:NodeJS
ode_modules
pm
[email protected]:1061:19)
npm ERR! at async Arborist.[buildDepStep] (D:NodeJS
ode_modules
pm
[email protected]:930:11)
npm ERR! at async Arborist.buildIdealTree (D:NodeJS
ode_modules
pm
[email protected]:216:7)
npm ERR! at async Promise.all (index 1)
npm ERR! at async Arborist.reify (D:NodeJS
ode_modules
pm
[email protected]
eify.js:149:5)
npm ERR! at async Install.install (D:NodeJS
ode_modules
pmlibinstall.js:170:5)
npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/webpack: EPERM: operation not permitted, open 'D:NodeJS
ode_cache_cacache mpbbab18e'
npm ERR! at D:NodeJS
ode_modules
pm
ode_modulesminipass-fetchlibody.js:162:15
npm ERR! at async Arborist.[nodeFromEdge] (D:NodeJS
ode_modules
pm
[email protected]:1061:19)
npm ERR! at async Arborist.[buildDepStep] (D:NodeJS
ode_modules
pm
[email protected]:930:11)
npm ERR! at async Arborist.buildIdealTree (D:NodeJS
ode_modules
pm
ode_modul[email protected]:216:7)
npm ERR! at async Promise.all (index 1)
npm ERR! at async Arborist.reify (D:NodeJS
ode_modules
pm
[email protected]
eify.js:149:5)
npm ERR! at async Install.install (D:NodeJS
ode_modules
pmlibinstall.js:170:5) {
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'D:\NodeJS
ode_cache_cacache\tmp\7bbab18e’,
npm ERR! type: ‘system’,
npm ERR! requiredBy: ‘.’
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It’s possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
(base) PS F: utorial-frontendwebpackcode> npm i webpack webpack-cli --save-dev
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path D:NodeJS
ode_cache_cacache mp71f2a33
npm ERR! errno EPERM
npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/webpack: EPERM: operation not permitted, open ‘D:NodeJS
ode_cache_cacache mp71f2a33’
npm ERR! at D:NodeJS
ode_modules
pm
ode_modulesminipass-fetchlibody.js:162:15
npm ERR! at async Arborist.[nodeFromEdge] (D:NodeJS
ode_modules
pm
[email protected]:1061:19)
npm ERR! at async Arborist.[buildDepStep] (D:NodeJS
ode_modules
pm
[email protected]:930:11)
npm ERR! at async Arborist.buildIdealTree (D:NodeJS
ode_modules
pm
[email protected]:216:7)
npm ERR! at async Promise.all (index 1)
npm ERR! at async Arborist.reify (D:NodeJS
ode_modules
pm
[email protected]
eify.js:149:5)
npm ERR! at async Install.install (D:NodeJS
ode_modules
pmlibinstall.js:170:5)
npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/webpack: EPERM: operation not permitted, open ‘D:NodeJS
ode_cache_cacache mp71f2a33’
npm ERR! at D:NodeJS
ode_modules
pm
ode_modulesminipass-fetchlibody.js:162:15
npm ERR! at async Arborist.[nodeFromEdge] (D:NodeJS
ode_modules
pm
[email protected]:1061:19)
npm ERR! at async Arborist.[buildDepStep] (D:NodeJS
ode_modules
pm
[email protected]:930:11)
npm ERR! at async Arborist.buildIdealTree (D:NodeJS
ode_modules
pm
[email protected]:216:7)
npm ERR! at async Promise.all (index 1)
npm ERR! at async Arborist.reify (D:NodeJS
ode_modules
pm
[email protected]
eify.js:149:5)
npm ERR! at async Install.install (D:NodeJS
ode_modules
pmlibinstall.js:170:5) {
npm ERR! code: ‘EPERM’,
npm ERR! syscall: ‘open’,
npm ERR! path: ‘D:\NodeJS
ode_cache_cacache\tmp\671f2a33’,
npm ERR! type: ‘system’,
npm ERR! requiredBy: ‘.’
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It’s possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
2 错误详解
该错误发生在修改npm
的全局安装路径之后,再执行npm install 包 -g
或是npm install 包
时发生,但是在管理员身份下运行cmd,均能执行成功.
2.1 修改npm
全局安装:
命令行:
npm config set prefix "D:NodeJS ode_global" npm config set cache "D:NodeJS ode_cache"
在C盘User/用户名/下有一个
.npmrc
的文件将上述
node_global
文件夹的路径加入环境变量
2.2 导致该安装问题的原因
没有管理员权限,无法在node_global
和node_cache
两个文件夹下进行一些必要的操作
2.3 修复方法
- 删除用户下的.npmrc文件,即不改变全局安装的路径(不够好,本质问题仍没有解决,全局还是会安装在C盘)
- 每次都用管理员身份运行命令行(不够方便,vscode 下的命令行默认也不是管理员身份运行的)
- 直接修改
node_global
和node_cache
文件夹的权限:- 右键文件夹,打开属性,切换到安全选项卡
- 选择编辑,将没有打钩的位置全部打上钩(即将其它用户的权限设置为与管理员相同),应用即可.
- 右键文件夹,打开属性,切换到安全选项卡
3 运行测试
安装webpack测试,成功!npm i webpack webpack-cli -g
npm i webpack webpack-cli --save-dev
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在.深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小.自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前.因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担.添加下方名片,即可获取全套学习资料哦
边栏推荐
- 电脑重要文件很多,如何备份比较安全?
- 立一个flag
- Use IN List Population in Your JDBC Application to Avoid Cursor Cache Contention Issues
- How IDEA runs web programs
- PHP Serialization: eval
- C#Assembly的使用
- 电商rpa是什么意思?跟电商rpi是一个意思吗?
- The 2nd activity of the TOGAF10 Standard Reading Club continues wonderfully, and the highlights will be reviewed!
- 0X7FFFFFFF,0X80000000「建议收藏」
- CentOS7 —— yum安装mysql
猜你喜欢
操作符详解
NPM 使用介绍
EXCEL如何快速拆分合并单元格数据
ERROR 1819 (HY000) Your password does not satisfy the current policy requirements
anaconda虚拟环境安装pytorch gpu版本
【CPU设计实战】简单流水线CPU设计
go中select语句
ECCV2022: Recursion on Transformer without adding parameters and less computation!
Invalid bound statement (not found)出现的原因和解决方法
PHP序列化:eval
随机推荐
[CPU Design Practice] Simple Pipeline CPU Design
基于去噪自编码器的故障隔离与识别方法
基本语法(二)
FIFO深度计算学习记录(汇总)
Istio微服务治理网格的全方面可视化监控(微服务架构展示、资源监控、流量监控、链路监控)
CentOS7 安装MySQL 图文详细教程
关于我放弃考研这件事儿
P5019 [NOIP2018 提高组] 铺设道路
五种数据提交方式的优化
Google Chrome(谷歌浏览器)安装使用
NameNode (NN) 和SecondaryNameNode (2NN)工作机制
CentOS7 installation MySQL graphic detailed tutorial
Centos7 install mysql5.7
PyQt5快速开发与实战 9.7 UI层的自动化测试
Edge Cloud Explained in Simple Depth | 4. Lifecycle Management
【OpenCV】-边缘检测汇总示例
ERROR 2003 (HY000) Can‘t connect to MySQL server on ‘localhost3306‘ (10061)解决办法
函数的参数
SAP message TK 248 solved
C#控件CheckBox的使用