[6.0.0-beta.2] - `ng new` tries to create app on a wrong path
Versions
Angular CLI: 6.0.0-beta.2
Node: 8.9.4
OS: win32 x64
PowerShell or CMD (I'm not running WSL)
Repro steps
npm install -g @angular/cli@nextng new some-app
Observed behavior
Running ng new some-app in c:\www has the following output:
PS C:\www> ng new some-app
create some-app/e2e/app.e2e-spec.ts (290 bytes)
create some-app/e2e/app.po.ts (208 bytes)
create some-app/e2e/tsconfig.e2e.json (235 bytes)
create some-app/karma.conf.js (923 bytes)
create some-app/package.json (1300 bytes)
create some-app/protractor.conf.js (722 bytes)
create some-app/README.md (1030 bytes)
create some-app/tsconfig.json (363 bytes)
create some-app/tslint.json (3012 bytes)
create some-app/.angular-cli.json (1243 bytes)
create some-app/.editorconfig (245 bytes)
create some-app/.gitignore (529 bytes)
create some-app/src/assets/.gitkeep (0 bytes)
create some-app/src/environments/environment.prod.ts (51 bytes)
create some-app/src/environments/environment.ts (387 bytes)
create some-app/src/favicon.ico (5430 bytes)
create some-app/src/index.html (294 bytes)
create some-app/src/main.ts (370 bytes)
create some-app/src/polyfills.ts (3114 bytes)
create some-app/src/styles.css (80 bytes)
create some-app/src/test.ts (642 bytes)
create some-app/src/tsconfig.app.json (211 bytes)
create some-app/src/tsconfig.spec.json (283 bytes)
create some-app/src/typings.d.ts (104 bytes)
create some-app/src/app/app.module.ts (316 bytes)
create some-app/src/app/app.component.html (1141 bytes)
create some-app/src/app/app.component.spec.ts (986 bytes)
create some-app/src/app/app.component.ts (207 bytes)
create some-app/src/app/app.component.css (0 bytes)
Error: ENOENT: no such file or directory, mkdir 'C:\C\www\some-app'
ENOENT: no such file or directory, mkdir 'C:\C\www\some-app'
Notice the path mentioned in the error C:\C\www\... instead of C:\www\...
Trying with the --directory flag has the same result. If I try an absolute path, like ng new some-app --directory='c:/www' even appends another c: at the end:
Error: ENOENT: no such file or directory, mkdir 'C:\C\www\c:'
ENOENT: no such file or directory, mkdir 'C:\C\www\c:'
Also, if I try c:\some\path - with \ instead of /, like we usually work on Windows, I get something like:
Error: Schematic input does not validate against the Schema
Errors:
.directory should match format "path"
I found that you are using Windows. try using CMD or Node.js command prompt to create the app.
C:\www>ng new some-app
create some-app/e2e/app.e2e-spec.ts (290 bytes)
create some-app/e2e/app.po.ts (208 bytes)
create some-app/e2e/tsconfig.e2e.json (235 bytes)
create some-app/karma.conf.js (923 bytes)
create some-app/package.json (1293 bytes)
create some-app/protractor.conf.js (722 bytes)
create some-app/README.md (1023 bytes)
create some-app/tsconfig.json (363 bytes)
create some-app/tslint.json (3012 bytes)
create some-app/.angular-cli.json (1243 bytes)
create some-app/.editorconfig (245 bytes)
create some-app/.gitignore (529 bytes)
create some-app/src/assets/.gitkeep (0 bytes)
create some-app/src/environments/environment.prod.ts (51 bytes)
create some-app/src/environments/environment.ts (387 bytes)
create some-app/src/favicon.ico (5430 bytes)
create some-app/src/index.html (294 bytes)
create some-app/src/main.ts (370 bytes)
create some-app/src/polyfills.ts (3114 bytes)
create some-app/src/styles.css (80 bytes)
create some-app/src/test.ts (642 bytes)
create some-app/src/tsconfig.app.json (211 bytes)
create some-app/src/tsconfig.spec.json (283 bytes)
create some-app/src/typings.d.ts (104 bytes)
create some-app/src/app/app.module.ts (316 bytes)
create some-app/src/app/app.component.html (1141 bytes)
create some-app/src/app/app.component.spec.ts (986 bytes)
create some-app/src/app/app.component.ts (207 bytes)
create some-app/src/app/app.component.css (0 bytes)
> [email protected] install C:\www\some-app\node_modules\uws
> node-gyp rebuild > build_log.txt 2>&1 || exit 0
> [email protected] install C:\www\some-app\node_modules\node-sass
> node scripts/install.js
Cached binary found at C:\Users\pulickal\AppData\Roaming\npm-cache\node-sass\4.7.2\win32-x64-57_binding.node
> [email protected] postinstall C:\www\some-app\node_modules\webpack\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js
> [email protected] postinstall C:\www\some-app\node_modules\node-sass
> node scripts/build.js
added 1232 packages in 250.136s
Project 'some-app' successfully created.
C:\www>
@athulreji I did try CMD also (in adition to PowerShell, which I usually use). The results can be seen in the attached screenshot. And now I've also tried with "Node.js command prompt" - but that's just CMD, isn't it? If I uninstall 6.0.0-beta.2 and install 1.7.0, then it works. CMD, PowerShell, doesn't matter - 1.7.0 works.

Same issue using CMD.
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 6.0.0-beta.2
Node: 9.5.0
OS: win32 x64
Angular:
...
Updated angular cli seems to be working for @MrCroft, @spongessuck try updating your cli by running the following commands:
npm uninstall -g angular-cli
npm cache clean
npm install -g @angular/cli@latest
@athulreji the issue is about 6.0.0-beta.2 (@next)
@latest installs 1.7.0 at the moment
Oh sorry about that.
Having the same issue, I tried git bash , cmd, powershell , cmder etc. I'm gona try downgrading to 6.0.0-beta.0... cos I just want to use the --service-worker flag npm uninstall -g angular-cli npm cache clean npm install -g @angular/[email protected] EDIT: Nope that says no valid targets
@SaabirMohamed --service-worker is available since 1.6.something I believe. Anyway, you definitely have it in the latest 1.7.0 stable.
@MrCroft ... Thanks for the quick response! I didn't know that I was following a tutorial and got stuck at this step.
@hansl Just tested 6.0.0-beta.3 and it's working. Thank you!
Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.
If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.
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.