当我尝试创建一个新的角度项目时,我遇到了以下错误

问题描述 投票:0回答:1

有人可以帮我解决这个错误吗?我正在尝试使用ng new app-name创建一个新的角度应用程序,但我得到以下错误,我是角度新手,不知道这个错误的原因。

CREATE angular-app/e2e/src/app.e2e-spec.ts (307 bytes)
CREATE angular-app/e2e/src/app.po.ts (208 bytes)
events.js:167
      throw er; // Unhandled 'error' event
      ^
Error: spawn C:\Program Files\Java\jdk1.8.0_144\jre ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:231:19)
    at onErrorNT (internal/child_process.js:406:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
    at startup (internal/bootstrap/node.js:266:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
    at onErrorNT (internal/child_process.js:406:16)
    [... lines matching original stack trace ...]
    at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)
node.js angular
1个回答
2
投票

这个问题有两个解决方案

解决方案1

卸载节点全局包并更新npm并重新安装全局包

解决方案2

创建新项目时有解决方法

 --skip-install --skip-git on ng new

来自Angular Issue Board

© www.soinside.com 2019 - 2024. All rights reserved.