NodeJS 在Windows上使用npm全局安装包失败,出现rimraf错误

6vl6ewon  于 2023-05-06  发布在  Node.js
关注(0)|答案(1)|浏览(634)

当我试图在我的Windows机器上全局安装软件包时,由于rimraf丢失而失败。奇怪的是,这是突然发生的,今天早上它工作得很好,而且它也发生在Azure DevOps托管的代理上。
我尝试更新npm,强制清理npm缓存,重新启动,并将节点更新到最新的LTS。似乎什么都不管用。我在cliui上没有看到任何开放的问题,所以我想这是在我们的结束不知何故,但我似乎找不到解决方案。

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
    • 编辑**
  • Windows 11
  • 在cmd行和PowerShell上运行
  • 节点版本:v18.16.0
  • NPM版本:9.6.5
  • 运行命令强制npm缓存清除:npm cache clean --force
mtb9vblg

mtb9vblg1#

这种情况自己解决了--我猜是一个子依赖项的发布,后来得到了修复。

相关问题