【问题标题】:Unable to install Angular 6.0.8无法安装 Angular 6.0.8
【发布时间】:2018-11-29 12:47:43
【问题描述】:

Angular 安装失败并出现以下错误,并且未安装 Angular。

D:\software\node-v8.11.2-win-x64>npm install -g @angular/cli D:\软件\node-v8.11.2-win-x64\ng -> D:\eclipse\software\node-v8.11.2-win-x64\node_modules@angular\cli\bin\ng

@angular/cli@6.0.8 安装后 D:\eclipse\software\node-v8.11.2-win-x64\node_modules@angular\cli 节点 ./bin/ng-update-message.js

'node' 不是内部或外部命令,可操作 程序或批处理文件。 npm WARN 可选跳过可选依赖: fsevents@1.2.4 (node_modules@angular\cli\node_modules\fsevents): npm 警告 notsup 跳过可选依赖:不支持的平台 fsevents@1.2.4: 想要 {"os":"darwin","arch":"any"}(当前: {"os":"win32","arch":"x64"})

npm 错误!代码 ELIFECYCLE npm 错误! errno 1 npm 错误! @angular/cli@6.0.8 安装后:节点 ./bin/ng-update-message.js npm ERR!退出状态 1 npm 错误! npm 错误! @angular/cli@6.0.8 安装后脚本失败。 npm 错误!这可能不是 npm 的问题。有可能 上面的附加日志输出。

npm 错误!可以在以下位置找到此运行的完整日志:npm ERR! C:\Users\N96304.LAUNCHER\AppData\Roaming\npm-cache_logs\2018-06-19T08_39_53_490Z-debug.lo

日志错误:

8474 info lifecycle @angular/cli@6.0.8~postinstall: @angular/cli@6.0.8
8475 verbose lifecycle @angular/cli@6.0.8~postinstall: unsafe-perm in lifecycle true
8476 verbose lifecycle @angular/cli@6.0.8~postinstall: PATH: D:software\node-v8.11.2-win-x64\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:software\node-v8.11.2-win-x64\node_modules\@angular\cli\node_modules\.bin;D:software\node-v8.11.2-win-x64\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft Application Virtualization Client;C:\Program Files (x86)\EHLLAPI\;C:\Program Files (x86)\PortalClient\;C:\Program Files (x86)\Citrix\ICAService;C:\Program Files (x86)\Citrix\System32;C:\Program Files (x86)\InstallShield\AdminStudio\6.0\ConflictSolver;C:\Program Files (x86)\Common Files\Citrix\system32;C:\Program Files\Citrix\System32\;C:\Program Files\Citrix\ICAService\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\instantclient_12_2;C:\Program Files\instantclient_12_2;D:software\New folder\Fiddler;D:software\Fiddler
8477 verbose lifecycle @angular/cli@6.0.8~postinstall: CWD: D:software\node-v8.11.2-win-x64\node_modules\@angular\cli
8478 silly lifecycle @angular/cli@6.0.8~postinstall: Args: [ '/d /s /c', 'node ./bin/ng-update-message.js' ]
8479 silly lifecycle @angular/cli@6.0.8~postinstall: Returned: code: 1  signal: null
8480 info lifecycle @angular/cli@6.0.8~postinstall: Failed to exec postinstall script
8481 verbose unlock done using C:\Users\N96304.LAUNCHER\AppData\Roaming\npm-cache\_locks\staging-acb702ed8f4300ec.lock for D:software\node-v8.11.2-win-x64\node_modules\.staging
8482 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\@angular\cli\node_modules\fsevents):
8483 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
8484 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
8484 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
8484 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   win32
8484 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
8485 verbose stack Error: @angular/cli@6.0.8 postinstall: `node ./bin/ng-update-message.js`
8485 verbose stack Exit status 1
8485 verbose stack     at EventEmitter.<anonymous> (D:software\node-v8.11.2-win-x64\node_modules\npm\node_modules\npm-lifecycle\index.js:285:16)
8485 verbose stack     at emitTwo (events.js:126:13)
8485 verbose stack     at EventEmitter.emit (events.js:214:7)
8485 verbose stack     at ChildProcess.<anonymous> (D:software\node-v8.11.2-win-x64\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
8485 verbose stack     at emitTwo (events.js:126:13)
8485 verbose stack     at ChildProcess.emit (events.js:214:7)
8485 verbose stack     at maybeClose (internal/child_process.js:925:16)
8485 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
8486 verbose pkgid @angular/cli@6.0.8
8487 verbose cwd D:software\node-v8.11.2-win-x64
8488 verbose Windows_NT 6.1.7601
8489 verbose argv "D:\\software\\node-v8.11.2-win-x64\\node.exe" "D:\\software\\node-v8.11.2-win-x64\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "@angular/cli"
8490 verbose node v8.11.2
8491 verbose npm  v5.6.0
8492 error code ELIFECYCLE
8493 error errno 1
8494 error @angular/cli@6.0.8 postinstall: `node ./bin/ng-update-message.js`
8494 error Exit status 1
8495 error Failed at the @angular/cli@6.0.8 postinstall script.
8495 error This is probably not a problem with npm. There is likely additional logging output above.
8496 verbose exit [ 1, true ]

【问题讨论】:

  • 需要安装节点
  • 检查路径中是否有node。打开 Cmd 并写入node
  • 尝试npm cache clean --force 然后npm install -g @angular/cli
  • 您是否以管理员身份运行?

标签: angular npm angular-cli


【解决方案1】:

请重新安装您的 node.js 并重试。确保环境变量 PATH 中有 Node.js。您也可以尝试重新安装 Angular-CLI。

【讨论】:

  • 我重新安装了 8.11.3(包括 npm 5.6.0)LTS 和 10.4.1(包括 npm 6.1.0)最新版本。我都遇到了同样的错误
【解决方案2】:

只需在系统变量中添加节点:变量:节点,路径:C:\Program Files\nodejs。

【讨论】:

    【解决方案3】:

    CMD --> 以管理员身份运行 --> C:\Program Files\nodejs> npm install -g @angular/cli

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-22
      • 2017-03-23
      • 2019-10-24
      • 1970-01-01
      • 2020-10-06
      • 2021-11-11
      相关资源
      最近更新 更多