[英]npm install -g @angular/cli command does not install angular cli
[英]npm install and npm i -g @angular/cli commands failing with command failed error
我克隆了一個 angular 存儲庫,運行npm i
並拋出以下錯誤:
PS C:\projects\FIFA\skeleton> npm i
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-
resolve#deprecated
npm ERR! code 3221225477
npm ERR! path C:\projects\FIFA\skeleton\node_modules\@angular\cli
npm ERR! command failed
npm ERR! command bash -c node ./bin/postinstall/script.js
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\148965\AppData\Local\npm-cache\_logs\2022-03-01T03_54_05_112Z-debug-0.log
我運行了這個命令npm cache clean --force
仍然npm i
拋出了同樣的錯誤。
我將nodejs
從16.13.0
升級到16.14.0
,但仍然是npm i
拋出了同樣的錯誤。
我卸載了@angular/cli npm uninstall -g @angular/cli
並在重新安裝它時npm i -g @angular/cli
面臨同樣的錯誤:
npm ERR! code 3221225477
npm ERR! path C:\Users\148965\AppData\Roaming\npm\node_modules\@angular\cli
npm ERR! command failed
npm ERR! command bash -c node ./bin/postinstall/script.js
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\148965\AppData\Local\npm-cache\_logs\2022-03-01T04_19_25_333Z-debug-0.log
正在安裝一些軟件包,例如: npm i -g http-server
和npm i -g lite-server
面臨與npm i -g nodemon
相同的問題
npm i
在其他節點項目中也能正常工作。
問題僅存在於 Angular 中。
完整詳細:
1014 verbose stack Error: command failed
1014 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
1014 verbose stack at ChildProcess.emit (node:events:520:28)
1014 verbose stack at maybeClose (node:internal/child_process:1092:16)
1014 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
1015 verbose pkgid @angular/cli@13.2.5
1016 verbose cwd C:\projects\FIFA\examples
1017 verbose Windows_NT 10.0.19043
1018 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "@angular/cli"
1019 verbose node v16.14.0
1020 verbose npm v8.3.1
1021 error code 3221225477
1022 error path C:\Users\148965\AppData\Roaming\npm\node_modules\@angular\cli
1023 error command failed
1024 error command bash -c node ./bin/postinstall/script.js
1025 verbose exit 3221225477
1026 timing npm Completed in 13130ms
1027 verbose unfinished npm timer reify 1646108365627
1028 verbose unfinished npm timer reify:build 1646108377372
1029 verbose unfinished npm timer build 1646108377373
1030 verbose unfinished npm timer build:deps 1646108377373
1031 verbose unfinished npm timer build:run:postinstall 1646108377399
1032 verbose unfinished npm timer build:run:postinstall:node_modules/@angular/cli 1646108377399
1033 verbose code 3221225477
1034 error A complete log of this run can be found in:
1034 error C:\Users\148965\AppData\Local\npm-cache\_logs\2022-03-01T04_19_25_333Z-debug-0.log
節點版本:
npm -v
8.3.1
node -v
v16.14.0
我無法理解是什么導致了這個問題。 直到昨天一切都很好。
任何幫助都很感激。 提前致謝。
錯誤行
npm ERR! command failed
npm ERR! command bash -c node ./bin/postinstall/script.js
建議執行 bash 命令(shell 腳本)時出現問題。
據我了解,當 npm 當前正在使用的 shell 已損壞時,就會出現此錯誤。
以下命令重置 shell 以用於使用 npm exec、npm run 和 npm init 命令運行的腳本。
npm config delete script-shell
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.