windows系统下nodeJS项目删除node_modules

本文分享了一种有效的node_modules文件夹删除方法,在项目目录下通过命令行输入'rm -r node_modules',解决了rimraf命令未能成功的问题。

尝试了很多解决方案,如:

 1、npm install rimraf --save-dev

 2、rimraf node_modules

此方法没有删除成功,但是网上许多人是说很有效,原因待查

我的解决方案:

在项目目录下,命令行输入:rm -r node_modules

参考链接:https://www.itranslater.com/qa/details/2120246956663505920

0 verbose cli E:\Nodejs\node.exe E:\Nodejs\node_modules\npm\bin\npm-cli.js 1 info using npm@10.9.3 2 info using node@v22.18.0 3 silly config load:file:E:\Nodejs\node_modules\npm\npmrc 4 silly config load:file:E:\Nodejs\.npmrc 5 silly config load:file:C:\Users\TWZXZ\.npmrc 6 silly config load:file:E:\Nodejs\node_global\etc\npmrc 7 verbose title npm i 8 verbose argv "i" 9 verbose logfile logs-max:10 dir:E:\Nodejs\node_cache\_logs\2025-08-19T03_46_14_131Z- 10 verbose logfile E:\Nodejs\node_cache\_logs\2025-08-19T03_46_14_131Z-debug-0.log 11 silly logfile done cleaning log files 12 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368 13 silly idealTree buildDeps 14 silly reify mark retired [ 14 silly reify 'E:\\Nodejs\\node_modules\\corepack', 14 silly reify 'E:\\Nodejs\\node_modules\\.bin\\corepack', 14 silly reify 'E:\\Nodejs\\node_modules\\.bin\\corepack.cmd', 14 silly reify 'E:\\Nodejs\\node_modules\\.bin\\corepack.ps1', 14 silly reify 'E:\\Nodejs\\node_modules\\.bin\\pnpm', 14 silly reify 'E:\\Nodejs\\node_modules\\.bin\\pnpm.cmd', 14 silly reify 'E:\\Nodejs\\node_modules\\.bin\\pnpm.ps1', 14 silly reify 'E:\\Nodejs\\node_modules\\.bin\\pnpx', 14 silly reify 'E:\\Nodejs\\node_modules\\.bin\\pnpx.cmd', 14 silly reify 'E:\\Nodejs\\node_modules\\.bin\\pnpx.ps1', 14 silly reify 'E:\\Nodejs\\node_modules\\.bin\\yarn', 14 silly reify 'E:\\Nodejs\\node_modules\\.bin\\yarn.cmd', 14 silly reify 'E:\\Nodejs\\node_modules\\.bin\\yarn.ps1', 14 silly reify 'E:\\Nodejs\\node_modules\\.bin\\yarnpkg', 14 silly reify 'E:\\Nodejs\\node_modules\\.bin\\yarnpkg.cmd', 14 silly reify 'E:\\Nodejs\\node_modules\\.bin\\yarnpkg.ps1' 14 silly reify ] 15 silly reify mark retired [ 15 silly reify 'E:\\Nodejs\\node_modules\\npm', 15 silly reify 'E:\\Nodejs\\node_modules\\.bin\\npm', 15 silly reify 'E:\\Nodejs\\node_modules\\.bin\\npm.cmd', 15 silly reify 'E:\\Nodejs\\node_modules\\.bin\\npm.ps1', 15 silly reify 'E:\\Nodejs\\node_modules\\.bin\\npx', 15 silly reify 'E:\\Nodejs\\node_modules\\.bin\\npx.cmd', 15 silly reify 'E:\\Nodejs\\node_modules\\.bin\\npx.ps1' 15 silly reify ] 16 silly reify moves { 16 silly reify 'E:\\Nodejs\\node_modules\\corepack': 'E:\\Nodejs\\node_modules\\.corepack-TazB0fz0', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\corepack': 'E:\\Nodejs\\node_modules\\.bin\\.corepack-Xjm9lJJu', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\corepack.cmd': 'E:\\Nodejs\\node_modules\\.bin\\.corepack.cmd-bANaGDMi', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\corepack.ps1': 'E:\\Nodejs\\node_modules\\.bin\\.corepack.ps1-89i3ki76', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\pnpm': 'E:\\Nodejs\\node_modules\\.bin\\.pnpm-XacJDRv2', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\pnpm.cmd': 'E:\\Nodejs\\node_modules\\.bin\\.pnpm.cmd-eNNmuyJc', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\pnpm.ps1': 'E:\\Nodejs\\node_modules\\.bin\\.pnpm.ps1-FxDIVAxg', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\pnpx': 'E:\\Nodejs\\node_modules\\.bin\\.pnpx-qOHiJJnI', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\pnpx.cmd': 'E:\\Nodejs\\node_modules\\.bin\\.pnpx.cmd-Ky7keCtp', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\pnpx.ps1': 'E:\\Nodejs\\node_modules\\.bin\\.pnpx.ps1-5rP1jcrE', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\yarn': 'E:\\Nodejs\\node_modules\\.bin\\.yarn-VIeJ6OEg', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\yarn.cmd': 'E:\\Nodejs\\node_modules\\.bin\\.yarn.cmd-zaco9pJw', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\yarn.ps1': 'E:\\Nodejs\\node_modules\\.bin\\.yarn.ps1-MKbIT2Vr', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\yarnpkg': 'E:\\Nodejs\\node_modules\\.bin\\.yarnpkg-DHEKIXE3', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\yarnpkg.cmd': 'E:\\Nodejs\\node_modules\\.bin\\.yarnpkg.cmd-sOFJdgEy', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\yarnpkg.ps1': 'E:\\Nodejs\\node_modules\\.bin\\.yarnpkg.ps1-KL6aHo0i', 16 silly reify 'E:\\Nodejs\\node_modules\\npm': 'E:\\Nodejs\\node_modules\\.npm-aRCg9uFH', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\npm': 'E:\\Nodejs\\node_modules\\.bin\\.npm-DJEtiCiv', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\npm.cmd': 'E:\\Nodejs\\node_modules\\.bin\\.npm.cmd-cxfDcKI9', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\npm.ps1': 'E:\\Nodejs\\node_modules\\.bin\\.npm.ps1-9ElEEcBh', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\npx': 'E:\\Nodejs\\node_modules\\.bin\\.npx-TokDAIWK', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\npx.cmd': 'E:\\Nodejs\\node_modules\\.bin\\.npx.cmd-1QAa2chW', 16 silly reify 'E:\\Nodejs\\node_modules\\.bin\\npx.ps1': 'E:\\Nodejs\\node_modules\\.bin\\.npx.ps1-3uMFQiFA' 16 silly reify } 17 verbose cwd E:\Nodejs 18 verbose os Windows_NT 10.0.26100 19 verbose node v22.18.0 20 verbose npm v10.9.3 21 verbose exit 1 22 verbose code 1 23 error A complete log of this run can be found in: E:\Nodejs\node_cache\_logs\2025-08-19T03_46_14_131Z-debug-0.log
最新发布
08-20
npm ERR! path D:\nodejs10.16.3\node_global\node_modules\cnpm\node_modules\.make-fetch-happen.DELETE\node_modules\@npmcli npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall rename npm ERR! Error: EPERM: operation not permitted, rename 'D:\nodejs10.16.3\node_global\node_modules\cnpm\node_modules\.make-fetch-happen.DELETE\node_modules\@npmcli' -> 'D:\nodejs10.16.3\node_global\node_modules\cnpm\node_modules\make-fetch-happen\node_modules\@npmcli' npm ERR! { [Error: EPERM: operation not permitted, rename 'D:\nodejs10.16.3\node_global\node_modules\cnpm\node_modules\.make-fetch-happen.DELETE\node_modules\@npmcli' -> 'D:\nodejs10.16.3\node_global\node_modules\cnpm\node_modules\make-fetch-happen\node_modules\@npmcli'] npm ERR! cause: npm ERR! { Error: EPERM: operation not permitted, rename 'D:\nodejs10.16.3\node_global\node_modules\cnpm\node_modules\.make-fetch-happen.DELETE\node_modules\@npmcli' -> 'D:\nodejs10.16.3\node_global\node_modules\cnpm\node_modules\make-fetch-happen\node_modules\@npmcli' npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'rename', npm ERR! path: npm ERR! 'D:\\nodejs10.16.3\\node_global\\node_modules\\cnpm\\node_modules\\.make-fetch-happen.DELETE\\node_modules\\@npmcli', npm ERR! dest: npm ERR! 'D:\\nodejs10.16.3\\node_global\\node_modules\\cnpm\\node_modules\\make-fetch-happen\\node_modules\\@npmcli' }, npm ERR! stack: npm ERR! 'Error: EPERM: operation not permitted, rename \'D:\\nodejs10.16.3\\node_global\\node_modules\\cnpm\\node_modules\\.make-fetch-happen.DELETE\\node_modules\\@npmcli\' -> \'D:\\nodejs10.16.3\\node_global\\node_modules\\cnpm\\node_modules\\make-fetch-happen\\node_modules\\@npmcli\'', npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'rename', npm ERR! path: npm ERR! 'D:\\nodejs10.16.3\\node_global\\node_modules\\cnpm\\node_modules\\.make-fetch-happen.DELETE\\node_modules\\@npmcli', npm ERR! dest: npm ERR! 'D:\\nodejs10.16.3\\node_global\\node_modules\\cnpm\\node_modules\\make-fetch-happen\\node_modules\\@npmcli', npm ERR! parent: 'cnpm' } 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 (though this is not recommended). npm ERR! A complete log of this run can be found in: npm ERR! D:\nodejs10.16.3\node_cache\_logs\2025-08-10T17_11_49_075Z-debug.log
08-12
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值