一个致命的问题关于nodejs的npm

本文记录了作者遇到npm命令在CMD中无法使用的问题,尝试多种解决办法包括环境配置检查、重装Node.js及清理注册表等均未果,最终通过重新安装系统解决了问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

具体情况是这样的某天我要用到npm去安装一些东西但是我去cmd中使用npm命令的时候却发现npm不是

'npm' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

当然前提是我之前可以使用,但是现在却无法使用而且出现这个问题,然后我就去寻找各种环境配置和重装,经历了几个小时之后我依然失败,然后我点开了我第二个win10系统,然后在上面装nodejs一套流程下来npm就可以用了,当然这个处理方式是在你实在无法解决的时候使用。当然我也清空注册表一切能做到的事情都尝试了一遍。但是最后都是失败的,只有去新搞一个系统才能使用,所以这个是个致命的问题。

D:\vueTest\hello_vue3>npm install vue@3 vue-router@4 vuex@4 npm warn ERESOLVE overriding peer dependency npm warn While resolving: hello_vue3@0.0.0 npm warn Found: vue@3.5.13 npm warn node_modules/vue npm warn peer vue@"^3.2.25" from @vitejs/plugin-vue@5.2.1 npm warn node_modules/@vitejs/plugin-vue npm warn dev @vitejs/plugin-vue@"^5.2.1" from the root project npm warn 4 more (@vue/devtools-core, @vue/server-renderer, ...) npm warn npm warn Could not resolve dependency: npm warn peer vue@"^3.2.25" from @vitejs/plugin-vue@5.2.1 npm warn node_modules/@vitejs/plugin-vue npm warn dev @vitejs/plugin-vue@"^5.2.1" from the root project npm warn ERESOLVE overriding peer dependency npm warn While resolving: hello_vue3@0.0.0 npm warn Found: vue@3.5.13 npm warn node_modules/vue npm warn peer vue@"^3.2.25" from @vitejs/plugin-vue@5.2.1 npm warn node_modules/@vitejs/plugin-vue npm warn dev @vitejs/plugin-vue@"^5.2.1" from the root project npm warn 4 more (@vue/devtools-core, @vue/server-renderer, ...) npm warn npm warn Could not resolve dependency: npm warn peerOptional vue@"^3.4.0" from @vue/tsconfig@0.7.0 npm warn node_modules/@vue/tsconfig npm warn dev @vue/tsconfig@"^0.7.0" from the root project npm error code EPERM npm error syscall open npm error path D:\NodeJs\node_cache\_cacache\tmp\d26cdece npm error errno EPERM npm error FetchError: Invalid response body while trying to fetch https://registry.npmmirror.com/vue: EPERM: operation not permitted, open 'D:\NodeJs\node_cache\_cacache\tmp\d26cdece' npm error at D:\NodeJs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:170:15 npm error at async Response.json (D:\NodeJs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:75:17) npm error at async RegistryFetcher.packument (D:\NodeJs\node_modules\npm\node_modules\pacote\lib\registry.js:98:25) npm error at async RegistryFetcher.manifest (D:\NodeJs\node_modules\npm\node_modules\pacote\lib\registry.js:128:23) npm error at async #fetchManifest (D:\NodeJs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1202:20) npm error at async #nodeFromEdge (D:\NodeJs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1040:19) npm error at async #buildDepStep (D:\NodeJs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:904:11) npm error at async Arborist.buildIdealTree (D:\NodeJs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:181:7) npm error at async Promise.all (index 1) npm error at async Arborist.reify (D:\NodeJs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:131:5) { npm error code: 'EPERM', npm error errno: 'EPERM', npm error syscall: 'open', npm error path: 'D:\\NodeJs\\node_cache\\_cacache\\tmp\\d26cdece', npm error type: 'system', npm error requiredBy: '.' npm error } npm error npm error The operation was rejected by your operating system. npm error It's possible that the file was already in use (by a text editor or antivirus), npm error or that you lack permissions to access it. npm error npm error If you believe this might be a permissions issue, please double-check the npm error permissions of the file and its containing directories, or try running npm error the command again as root/Administrator. npm error Log files were not written due to an error writing to the directory: D:\NodeJs\node_cache\_logs npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
最新发布
03-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

轻烟飘荡

我想吃甜筒

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值