Angular ng new return软件包安装失败错误-缺少Compiler.umd.js

时间:2019-06-07 18:27:51

标签: node.js angular

我正在尝试学习Angular,并正在关注在线教程。但是,我似乎无法摆脱使用ng new创建新项目的麻烦。我在Windows 7上运行节点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清除缓存,以管理员身份运行,重新启动。没有任何帮助。

请注意,我是一个完全菜鸟,只是想学习该框架,目前看来无法使用它。

我希望这些软件包能够安装并且项目创建不会出现问题。

3 个答案:

答案 0 :(得分:0)

由于某些原因,当angular / cli(ng)自行运行npm install时,它在编写软件包方面存在问题,因此您可以运行

ng new yourProject --skipInstall=true

因此angular / cli将不会安装任何节点软件包,然后再运行

npm install --force

自行安装

答案 1 :(得分:0)

我遇到了这个问题,解决方法是:

  1. 转到编辑系统环境变量
  2. 用户的用户变量 ==> 路径下,请确保其上方的 C:\ Users \ user \ AppData \ Roaming \ npm 全部,并确保您是 添加当前用户目录。

注意:如果您没有当前用户目录,则必须创建它。

enter image description here

3。在系统变量 ==> 路径下,确保* C:\ Program Files \ nodejs * 首先。< / p>

enter image description here

  1. 用户的身份打开命令提示符 ==> npm cache clean --force
  2. npm install -g npm @ lates t。
  3. ng新的yourApp
  4. ng服务-打开

答案 2 :(得分:-1)

您要离线工作吗?您需要在线,以便npm可以下载项目的依赖项。

相关问题