Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I created a new project but there was a problem - Unhandled 'error' event #12670

Closed
ghost opened this issue Oct 21, 2018 · 14 comments · Fixed by #12951
Closed

I created a new project but there was a problem - Unhandled 'error' event #12670

ghost opened this issue Oct 21, 2018 · 14 comments · Fixed by #12951

Comments

@ghost
Copy link

ghost commented Oct 21, 2018

Bug Report or Feature Request (mark with an x)

- [ ×] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [x ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

node -- v8.12.0;
npm --6.4.1;
ng --7.0.2;
Windows (10)

Repro steps

The log given by the failure

E:>ng new kl
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? SCSS [ http://sass-lang.com ]
CREATE kl/angular.json (3823 bytes)
CREATE kl/package.json (1309 bytes)
CREATE kl/README.md (1019 bytes)
CREATE kl/tsconfig.json (408 bytes)
CREATE kl/tslint.json (2837 bytes)
CREATE kl/.editorconfig (245 bytes)
CREATE kl/.gitignore (503 bytes)
CREATE kl/src/favicon.ico (5430 bytes)
CREATE kl/src/index.html (289 bytes)
CREATE kl/src/main.ts (372 bytes)
CREATE kl/src/polyfills.ts (3234 bytes)
CREATE kl/src/test.ts (642 bytes)
CREATE kl/src/styles.scss (80 bytes)
CREATE kl/src/browserslist (388 bytes)
CREATE kl/src/karma.conf.js (964 bytes)
CREATE kl/src/tsconfig.app.json (166 bytes)
CREATE kl/src/tsconfig.spec.json (256 bytes)
CREATE kl/src/tslint.json (314 bytes)
CREATE kl/src/assets/.gitkeep (0 bytes)
CREATE kl/src/environments/environment.prod.ts (51 bytes)
CREATE kl/src/environments/environment.ts (662 bytes)
CREATE kl/src/app/app-routing.module.ts (245 bytes)
CREATE kl/src/app/app.module.ts (393 bytes)
CREATE kl/src/app/app.component.html (1173 bytes)
CREATE kl/src/app/app.component.spec.ts (1083 bytes)
CREATE kl/src/app/app.component.ts (207 bytes)
CREATE kl/src/app/app.component.scss (0 bytes)
CREATE kl/e2e/protractor.conf.js (752 bytes)
CREATE kl/e2e/tsconfig.e2e.json (213 bytes)
CREATE kl/e2e/src/app.e2e-spec.ts (298 bytes)
CREATE kl/e2e/src/app.po.ts (208 bytes)
events.js:183
throw er; // Unhandled 'error' event
^

Error: spawn C:\Windows\system32\cmd.exe ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:362:16)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)

Desired functionality

Mention any other details that might be useful

@Li-Mark
Copy link

Li-Mark commented Oct 21, 2018

I also got the issue with
node -- v10.12.0;
npm --6.4.1;
ng --7.0.2;
Windows (10)

@hexl84
Copy link

hexl84 commented Oct 23, 2018

I get the same issue also.

I can not create a new workspace with ng new in windows10

Command : ng new my-app

npm: 6.4.1
Angular CLI: 7.0.2
Node: 8.12.0
OS: win32 x64

Package Version
@angular-devkit/architect 0.10.2
@angular-devkit/core 7.0.2
@angular-devkit/schematics 7.0.2
@schematics/angular 7.0.2
@schematics/update 0.10.2
rxjs 6.3.3
typescript 3.1.3

I get error after I run the ng new my-app as below:
.......
CREATE my-app/src/app/app.component.css (0 bytes)
CREATE my-app/e2e/protractor.conf.js (752 bytes)
CREATE my-app/e2e/tsconfig.e2e.json (213 bytes)
CREATE my-app/e2e/src/app.e2e-spec.ts (302 bytes)
CREATE my-app/e2e/src/app.po.ts (208 bytes)
events.js:183
throw er; // Unhandled 'error' event
^

Error: spawn C:\Windows\system32\cmd.exe ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:362:16)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Oct 23, 2018

This usually means that the resolved cwd path is invalid, or the cmd path is incorrect.

If you do execute pwd and where cmd in the terminal where you are trying to do ng new what is the output?

@alan-agius4 alan-agius4 added the needs: more info Reporter must clarify the issue label Oct 23, 2018
@Li-Mark
Copy link

Li-Mark commented Oct 23, 2018

@alan-agius4
As your tips, when I got your reply.
First, I restarted the PC and created a new project with powershell, there isn't any issue.

Then I tried to create another project with cmd, it can be also created.

That's so weird. The issue is gone. I don't know why.
`? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? SCSS [ http://sass-lang.com ]
CREATE test-app/angular.json (3877 bytes)
CREATE test-app/package.json (1315 bytes)
CREATE test-app/README.md (1024 bytes)
CREATE test-app/tsconfig.json (408 bytes)
CREATE test-app/tslint.json (2837 bytes)
CREATE test-app/.editorconfig (245 bytes)
CREATE test-app/.gitignore (503 bytes)
CREATE test-app/src/favicon.ico (5430 bytes)
CREATE test-app/src/index.html (294 bytes)
CREATE test-app/src/main.ts (372 bytes)
CREATE test-app/src/polyfills.ts (3234 bytes)
CREATE test-app/src/test.ts (642 bytes)
CREATE test-app/src/styles.scss (80 bytes)
CREATE test-app/src/browserslist (388 bytes)
CREATE test-app/src/karma.conf.js (964 bytes)
CREATE test-app/src/tsconfig.app.json (166 bytes)
CREATE test-app/src/tsconfig.spec.json (256 bytes)
CREATE test-app/src/tslint.json (314 bytes)
CREATE test-app/src/assets/.gitkeep (0 bytes)
CREATE test-app/src/environments/environment.prod.ts (51 bytes)
CREATE test-app/src/environments/environment.ts (662 bytes)
CREATE test-app/src/app/app-routing.module.ts (245 bytes)
CREATE test-app/src/app/app.module.ts (393 bytes)
CREATE test-app/src/app/app.component.html (1173 bytes)
CREATE test-app/src/app/app.component.spec.ts (1101 bytes)
CREATE test-app/src/app/app.component.ts (213 bytes)
CREATE test-app/src/app/app.component.scss (0 bytes)
CREATE test-app/e2e/protractor.conf.js (752 bytes)
CREATE test-app/e2e/tsconfig.e2e.json (213 bytes)
CREATE test-app/e2e/src/app.e2e-spec.ts (304 bytes)
CREATE test-app/e2e/src/app.po.ts (208 bytes)

node-sass@4.9.3 install C:\Users...\test-app\node_modules\node-sass
node scripts/install.js

Cached binary found at C:\Users...\AppData\Roaming\npm-cache\node-sass\4.9.3\win32-x64-64_binding.node

circular-json@0.5.8 postinstall C:\Users...\test-app\node_modules\circular-json
echo ''; echo -e "\x1B[1mCircularJSON\x1B[0m is in \x1B[4mmaintenance only\x1B[0m, \x1B[1mflatted\x1B[0m is its successor."; echo ''

''; echo -e "\x1B[1mCircularJSON\x1B[0m is in \x1B[4mmaintenance only\x1B[0m, \x1B[1mflatted\x1B[0m is its successor."; echo ''

node-sass@4.9.3 postinstall C:\Users...\test-app\node_modules\node-sass
node scripts/build.js

Binary found at C:\Users...\test-app\node_modules\node-sass\vendor\win32-x64-64\binding.node
Testing binary
Binary is fine
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 1097 packages from 1292 contributors and audited 39125 packages in 79.669s
found 0 vulnerabilities

'git' is not recognized as an internal or external command,
operable program or batch file.`

This usually means that the resolved cwd path is invalid, or the cmd path is incorrect.

If you do execute pwd and where cmd in the terminal where you are trying to do ng new what is the output?

@grebneglig
Copy link

Thanks @alan-agius4 i could resolve for me.
I tried to create an project in "D:" and got the same error as @MangoWHL.
Then i created a project in "D:\Test" and all was ok.
So i think the Problem was the Path.

@lranders
Copy link

lranders commented Oct 24, 2018

I can reproduce the exact same behavior on Windows 10 as @grebneglig,
if I try ng new in the root of any of my drives.
Make and enter a folder, and the error goes away.

@hexl84
Copy link

hexl84 commented Oct 25, 2018

Thanks @grebneglig @lranders , I create a folder under the root of the driver, then ng new under the folder, it works.

@Exocomp
Copy link

Exocomp commented Oct 31, 2018

I get the same issue when creating a project on root of a drive for example:

R:\

Create a project one level deep works:

R:\test

ng --version

Angular CLI: 7.0.3
Node: 8.9.4
OS: win32 x64

@alan-agius4 alan-agius4 added freq3: high and removed freq1: low Only reported by a handful of users who observe it rarely needs: more info Reporter must clarify the issue labels Nov 2, 2018
@aaymont
Copy link

aaymont commented Nov 6, 2018

Can also confirm failing with the same error when trying to create a new project from the root directory of a drive on Windows 10, but works if it's inside a sub-directory.

@amirzenoozi
Copy link

I get the same issue when creating a project on root of a drive for example:
F:\
Create a project one level deep works:
F:\TestDirectory
But i want to create project on root of a driver
how can i ?

@adamdport
Copy link

@amirzenoozi create the project one level deep and then move it?

@alan-agius4 alan-agius4 changed the title I created a new project but there was a problem I created a new project but there was a problem - Unhandled 'error' event Nov 13, 2018
@alan-agius4
Copy link
Collaborator

alan-agius4 commented Nov 13, 2018

Hi all, we have identified the bug that is causing this error, as at the moment we are not handling root paths correctly in windows.

We landed a PR #12951 to fix the issue.

kyliau pushed a commit that referenced this issue Nov 14, 2018
When normalized path will not have a trailing slash, and at the moment the RegExp for drive needs to match `\c\`

Fixes #12670
kyliau pushed a commit to kyliau/angular-cli that referenced this issue Nov 14, 2018
When normalized path will not have a trailing slash, and at the moment the RegExp for drive needs to match `\c\`

Fixes angular#12670
@TahirMehmood
Copy link

TahirMehmood commented Jul 23, 2019

i am getting same issue but not in root drive
e:\code\FrontEnd\Angular-by-bradtraversy
still getting same error

ng serve --open
10% building 3/3 modules 0 activei 「wds」: Project is running at http://localhost:4200/webpack-dev-server/
i 「wds」: webpack output is served from /
i 「wds」: 404s will fallback to //index.html

chunk {main} main.js, main.js.map (main) 11.6 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 251 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.09 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 16.3 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 4.07 MB [initial] [rendered]
Date: 2019-07-23T03:03:43.732Z - Hash: 178530f1609a19eea4fd - Time: 16578ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i 「wdm」: Compiled successfully.
events.js:170
throw er; // Unhandled 'error' event
^

Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:247:19)
at onErrorNT (internal/child_process.js:429:16)
at processTicksAndRejections (internal/process/task_queues.js:81:17)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:253:12)
at onErrorNT (internal/child_process.js:429:16)
at processTicksAndRejections (internal/process/task_queues.js:81:17)

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants