当前位置:网站首页>Error: npm ERR code EPERM
Error: npm ERR code EPERM
2022-07-30 05:59:00 【m0_67392273】
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
[email protected]liarboristlibarboristuild-ideal-tree.js: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 -gnpm i webpack webpack-cli --save-dev
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在.深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小.自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前.因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担.添加下方名片,即可获取全套学习资料哦
边栏推荐
- cnpm安装步骤
- MySql string splitting realizes the split function (field splitting, column switching, row switching)
- 黄金圈法则:成功者必备的深度思考方法
- 成绩排序(华中科技大学考研机试题)(DAY 87)
- PyCharm usage tutorial (more detailed, picture + text)
- MySQL (2)
- 4、nerf(pytorch)
- 报错:npm ERR code EPERM
- 应用实践 | Apache Doris 在百度智能云计费账单系统的应用实践
- MySQL基础(DDL、DML、DQL)
猜你喜欢

mysql 中 in 的用法

力扣541-反转字符串2——双指针法

从想当亿万富翁到职场、创业、爱情、抑郁、学医学武,我的程序人生

Programmers care guide, give yourself a chance to make the occasional relaxation of body and mind
![[GO Language Basics] 1. Why do I want to learn Golang and the popularization of GO language entry](/img/ac/80ab67505f7df52d92a206bc3dd50e.png)
[GO Language Basics] 1. Why do I want to learn Golang and the popularization of GO language entry

一文带你吃透js处理树状结构数据的增删改查

Different lower_case_table_names settings for server ('1') and data dictionary ('0') solution

号称年薪30万占比最多的专业,你知道是啥嘛?

MySql字符串拆分实现split功能(字段分割转列、转行)

MySQL的存储过程
随机推荐
asyncawait和promise的区别
从底层结构开始学习FPGA(6)----分布式RAM(DRAM,Distributed RAM)
nacos-2.0.3启动报错出现no datasource set的坑
[GO Language Basics] 1. Why do I want to learn Golang and the popularization of GO language entry
JVM 类加载机制 超详细学习笔记(三)
破纪录者(Google Kickstart2020 Round D Problem A)
【Koltin Flow(一)】五种创建flow的方式
个人博客系统(附源码)
手把手教你设计一个CSDN系统
cmd(命令行)操作或连接mysql数据库,以及创建数据库与表
程序员赚钱实操,手把手教你做付费课程,自媒体,付费文章及付费技术课赚钱
Within the SQL connection table (link connections, left or right, cross connection, full outer join)
一文带你吃透js处理树状结构数据的增删改查
质数(清华大学机试题)(DAY 86)
MySql字符串拆分实现split功能(字段分割转列、转行)
4461. 范围分区(Google Kickstart2022 Round C Problem B)
微信支付及支付回调
应用实践 | Apache Doris 在百度智能云计费账单系统的应用实践
报错:npm ERR code EPERM
力扣20-有效的括号——栈实现