无法使用Angular CLI创建新项目

时间:2018-10-01 16:18:02

标签: angular angular-cli

Nodejs版本已安装-8.12.0 已安装npm版本-6.4.1

我能够使用“ npm install -g @ angular / cli”安装角度CLI 但是当我尝试使用“ ng new myapp”创建项目时,出现以下错误:

  

events.js:183         投掷者//未处理的“错误”事件

     

错误:产生   C:\ Windows \ system32 \ cmd.exe; E:\ apache-maven-3.5.4 \ bin;情感   在Process.ChildProcess._handle_onexit(内部/child_process.js:190:19)   在onErrorNT(internal / child_process.js:362:16)   在_combinedTickCallback(内部/进程/ next_tick_js:139:11)   在process._tickCallback(internal / process / next_tick_js:181:9)

2 个答案:

答案 0 :(得分:1)

Your ComSpec environment variable is wrong, replace:

%SystemRoot%\system32\cmd.exe;E:\apache-maven-3.5.4\bin;

With the following:

%SystemRoot%\system32\cmd.exe

Then restart your cmd and retry to generate a project.

I have no idea why Maven got in there, it should not affect your Maven builds though.

答案 1 :(得分:0)

这些类型的问题可能是由于代理错误而发生的,通常是在防火墙后面。 参见https://github.com/angular/angular-cli/issues/11386

运行“ npm install”时,您是否可以输入代理?

请注意,在大多数情况下,如果安装依赖项时进程失败,则可以在CLI完成新应用程序的配置后运行“ npm install”。