You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows下npm全局安装包提示rimraf缺失失败问题求助

全局安装npm包因rimraf缺失导致安装失败

问题描述

在Windows 11机器上尝试全局安装@angular/cli@15.2时,因rimraf缺失导致安装失败。该问题突然出现,此前运行正常,且Azure DevOps托管代理也出现同样问题。cliui仓库未发现相关公开issue,怀疑是本地问题但未找到解决方案。

已尝试的解决操作

  • 更新npm
  • 执行npm cache clean --force强制清理缓存
  • 重启机器
  • 将Node.js升级至最新LTS版本(v18.16.0,对应npm v9.6.5)

报错信息

PS C:\projects\456\some-site> npm install -g @angular/cli@15.2
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\123a\\AppData\\Roaming\\npm\\node_modules\\@angular\\cli\\node_modules',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\123a\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\src\operators'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\123a\\AppData\\Roaming\\npm\\node_modules\\@angular\\cli\\node_modules\\rxjs\\src\\operators'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\123a\\AppData\\Roaming\\npm\\node_modules\\@angular\\cli',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\123a\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\observable'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\123a\\AppData\\Roaming\\npm\\node_modules\\@angular\\cli\\node_modules\\rxjs\\internal\\observable'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command C:\Program Files\nodejs\node.exe C:\Users\123a\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js install --force --cache=C:\Users\123a\AppData\Local\npm-cache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm ERR! code 1
npm ERR! npm ERR! path C:\Users\123a\AppData\Local\npm-cache\_cacache\tmp\git-cloneIxP6PW
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c npm run compile
npm ERR! npm ERR! > cliui@8.0.1 precompile
npm ERR! npm ERR! > rimraf build
npm ERR! npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm ERR! 'rimraf' is not recognized as an internal or external command,
npm ERR! npm ERR! operable program or batch file.
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in: C:\Users\123a\AppData\Local\npm-cache\_logs\2023-05-01T23_47_36_842Z-debug-0.log

npm ERR! A complete log of this run can be found in: C:\Users\123a\AppData\Local\npm-cache\_logs\2023-05-01T23_47_27_622Z-debug-0.log

补充信息

  • 已在cmd和PowerShell环境下执行过安装命令
  • Node.js版本:v18.16.0
  • npm版本:9.6.5

内容的提问来源于stack exchange,提问作者Taylor Ackley

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 05:54:57