简体   繁体   中英

I am getting following error when I try to create a new angular project

Could someone please help me with this error? I am trying to create a new angular app using ng new app-name but I get the following error, I am new to angular and not sure of the reason for this error.

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)

There are two solution for this issue

solution 1

uninstall node global packages and update npm and reinstall global packages

solution 2

There is workaround when you create a new project

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

from Angular Issue Board

This may also be related to the version of Node used. I had a very similar error when trying to start an Electron application. I noticed my global version of Node was 13 but the version of Electron in the project I was trying to run was 12. When I switched to version 12 with nvm, re-ran npm install - the error disappeared.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM