- 【版权所有,文章允许转载,但须以链接方式注明源地址,否则追究法律责任】
- 【创作不易,点个赞就是对我最大的支持】
前言
仅作为学习笔记,供大家参考
总结的不错的话,记得点赞收藏关注哦!
一、报错信息
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
二、解决方法
-
点击Windows按键,搜索命令提示符,如图:(一定要点击以管理员身份运行)
-
我项目在d盘输入 d: 然后一步一步找到项目路径的前台项目下(如图)
-
输入:
npm install -g cnpm --registry=https://registry.npm.taobao.org --verbose
-
等待下载,结果如图:
注:如还是不能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
指定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
解决方法
-
node版本过低,使用最新版本完美解决
-
我上一版本使用的是14,升级到了最新的20
-
下载最新版本:
nvm install 20.10.0
-
通过nvm切换版本:
nvm use 20.10.0
-
nvm list查看是否切换成功
如果帮助到你,三连顶一下,创作不易~
公众号:程序员温眉
CSDN:程序员温眉
每天进步一点点的程序员