Windows安装npm淘宝镜像npm ERR! errno -4048 npm ERR! code EPERM npm ERR! syscall unlink



  • 【版权所有,文章允许转载,但须以链接方式注明源地址,否则追究法律责任】
  • 【创作不易,点个赞就是对我最大的支持】


前言

仅作为学习笔记,供大家参考
总结的不错的话,记得点赞收藏关注哦!



一、报错信息


permissions of the file and its containing directories, or try running npm ERR!



npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path D:\BanGong\eclipse\WorkSpeace\JooLun-wx\joolun-wx-ui\node_modules\.staging\ant-design-vue-a7f0335c\dist\antd-with-locales.min.js
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'D:\BanGong\eclipse\WorkSpeace\JooLun-wx\joolun-wx-ui\node_modules\.staging\ant-design-vue-a7f0335c\dist\antd-with-locales.min.js'
npm ERR!  [OperationalError: EPERM: operation not permitted, unlink 'D:\BanGong\eclipse\WorkSpeace\JooLun-wx\joolun-wx-ui\node_modules\.staging\ant-design-vue-a7f0335c\dist\antd-with-lo
cales.min.js'] {
npm ERR!   cause: [Error: EPERM: operation not permitted, unlink 'D:\BanGong\eclipse\WorkSpeace\JooLun-wx\joolun-wx-ui\node_modules\.staging\ant-design-vue-a7f0335c\dist\antd-with-local
es.min.js'] {
npm ERR!     errno: -4048,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'unlink',
npm ERR!     path: 'D:\\BanGong\\eclipse\\WorkSpeace\\JooLun-wx\\joolun-wx-ui\\node_modules\\.staging\\ant-design-vue-a7f0335c\\dist\\antd-with-locales.min.js'
npm ERR!   },
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'D:\\BanGong\\eclipse\\WorkSpeace\\JooLun-wx\\joolun-wx-ui\\node_modules\\.staging\\ant-design-vue-a7f0335c\\dist\\antd-with-locales.min.js',
npm ERR!   parent: '@smallwei/avue'
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.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\BanGong\npm\node_cache\_logs\2022-06-01T01_48_26_519Z-debug.log

二、解决方法



  1. 点击Windows按键,搜索命令提示符,如图:(一定要点击以管理员身份运行)
    在这里插入图片描述

  2. 我项目在d盘输入 d: 然后一步一步找到项目路径的前台项目下(如图)

  3. 在这里插入图片描述

  4. 输入:npm install -g cnpm --registry=https://registry.npm.taobao.org --verbose

  5. 等待下载,结果如图:
    在这里插入图片描述

注:如还是不能npm run dev按我的方法走一遍,删除node_modules文件重新走一遍

1.npm install --registry=https://registry.npm.taobao.org

2. 如提示‘vue-cli-service‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件。执行:
npm install -g @vue/cli-service

3,安装vue,输入命令

npm install vue

4,安装vue-cli,输入命令

npm install --global vue-cli

5.(如报这个错A complete log if this run can be found in)执行全局更新
npm install npm -g
或者用淘宝镜像命令
cnpm install npm -g

在这里插入图片描述

查看node与npm版本是否匹配

指定npm版本命令:npm install -g npm@6.14.5

如果报这个错,node版本过低,下载个nvm,之后安装nvm install 14.1.0

npm ERR! vote@1.0.0 dev: `vite`

问题记录
报这个错,npm install --forace
在这里插入图片描述

三、状态码为:9 报错信息

node: --openssl-legacy-provider is not allowed in NODE_OPTIONS
npm ERR! code ELIFECYCLE
npm ERR! errno 9
npm ERR! ruoyi@3.8.6 dev: `set NODE_OPTIONS=--openssl-legacy-provider & vue-cli-service serve`
npm ERR! Exit status 9
npm ERR!
npm ERR! Failed at the ruoyi@3.8.6 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\BanGong\npm\node_cache\_logs\2023-12-08T01_42_13_159Z-debug.log

解决方法

  1. node版本过低,使用最新版本完美解决

  2. 我上一版本使用的是14,升级到了最新的20

  3. 下载最新版本:
    nvm install 20.10.0

  4. 通过nvm切换版本:
    nvm use 20.10.0

  5. nvm list查看是否切换成功

如果帮助到你,三连顶一下,创作不易~


公众号:程序员温眉

在这里插入图片描述
CSDN:程序员温眉

每天进步一点点的程序员

  • 5
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值