簡體   English   中英

Angular ng 新返回包安裝失敗錯誤 - compiler.umd.js 丟失

[英]Angular ng new returns package install failed error - compiler.umd.js missing

我正在嘗試學習 Angular,並且正在學習在線教程。 但是,我似乎無法使用 ng new 創建一個新項目。 我在 Windows 7 上運行 node v10.16.0 和 npm 6.9.0。我在日志中收到以下錯誤:

15177 verbose cwd C:\Personal documents\Angular\myProject
15178 verbose Windows_NT 6.1.7601
15179 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--quiet"
15180 verbose node v10.16.0
15181 verbose npm  v6.9.0
15182 error path C:\Personal documents\Angular\myProject\node_modules\.staging\typescript-f4316380\lib\lib.dom.d.ts
15183 error code EPERM
15184 error errno -4048
15185 error syscall unlink
15186 error Error: EPERM: operation not permitted, unlink 'C:\Personal documents\Angular\myProject\node_modules\.staging\typescript-f4316380\lib\lib.dom.d.ts'
15186 error  { [Error: EPERM: operation not permitted, unlink 'C:\Personal documents\Angular\myProject\node_modules\.staging\typescript-f4316380\lib\lib.dom.d.ts']
15186 error   cause:
15186 error    { Error: EPERM: operation not permitted, unlink 'C:\Personal documents\Angular\myProject\node_modules\.staging\typescript-f4316380\lib\lib.dom.d.ts'
15186 error      errno: -4048,
15186 error      code: 'EPERM',
15186 error      syscall: 'unlink',
15186 error      path:
15186 error       'C:\\Personal documents\\Angular\\myProject\\node_modules\\.staging\\typescript-f4316380\\lib\\lib.dom.d.ts' },
15186 error   stack:
15186 error    'Error: EPERM: operation not permitted, unlink \'C:\\Personal documents\\Angular\\myProject\\node_modules\\.staging\\typescript-f4316380\\lib\\lib.dom.d.ts\'',
15186 error   errno: -4048,
15186 error   code: 'EPERM',
15186 error   syscall: 'unlink',
15186 error   path:
15186 error    'C:\\Personal documents\\Angular\\myProject\\node_modules\\.staging\\typescript-f4316380\\lib\\lib.dom.d.ts',
15186 error   parent: '@angular-devkit/build-optimizer' }
15187 error The operation was rejected by your operating system.
15187 error It's possible that the file was already in use (by a text editor or antivirus),
15187 error or that you lack permissions to access it.
15187 error
15187 error If you believe this might be a permissions issue, please double-check the
15187 error permissions of the file and its containing directories, or try running
15187 error the command again as root/Administrator (though this is not recommended).
15188 verbose exit [ -4048, true ]

我遵循上面指定的路徑,lib 文件夾是空的。 我嘗試重新安裝節點,重新安裝 angular,使用 --force 清除緩存,以管理員身份運行,重新啟動。 沒有任何幫助。

請注意,我在這方面完全是個菜鳥,我只是想學習這個框架,現在似乎無法使用它。

我希望安裝軟件包和創建項目沒有問題。

由於某些原因,angular/cli (ng) 自己運行 npm install 時,寫包有問題,所以你可以運行

ng new yourProject --skipInstall=true

所以 angular/cli 不會安裝任何節點包然后運行

npm install --force

自己安裝

我遇到過這樣的問題,解決方案是:

  1. 轉到編輯系統環境變量
  2. User ==> Path 的User variables下,確保C:\\Users\\user\\AppData\\Roaming\\npm最重要,並確保添加當前用戶目錄。

注意:如果您沒有當前用戶目錄,則必須創建它。

在此處輸入圖片說明

3.在System variables ==> Path 下,確保 * C:\\Program Files\\nodejs*最重要。

在此處輸入圖片說明

  1. 用戶身份打開命令提示符==> npm cache clean --force
  2. npm install -g npm@lates t.
  3. ng 新的 yourApp
  4. ng 服務 --open

你離線工作嗎? 您需要在線,以便 npm 可以下載項目的依賴項。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM