Error when creating new project with Angular-CLI 6.1.2
Asked Answered
K

7

17

I tried creating a new Angular project using ng new angular-6-boilerplate but I can't do it anymore with angular-cli latest version. I'm using terminal for windows to create my project but I got this error.

Schematic input does not validate against the Schema: {"name":"angular-6-boilerplate","version":"6.1.2","newProjectRoot":"projects","skipInstall":false,"linkCli":false,"skipGit":false,"commit":null} Errors:

  Data path ".name" should match format "html-selector".

Why am I getting this error?

Killerdiller answered 4/8, 2018 at 23:49 Comment(0)
U
37

Do not include project name special characters or numbers. Try the following:

$ ng new angular-boilerplate

I did some research & found out that this comes from the schema responsible of creating new Angular applications Link Here

Ultrared answered 5/8, 2018 at 0:37 Comment(2)
yes, thank you. I did't know I wasn't allowed to use numbers when creating a new angular project in angular-cli 6.1.2. It was allowed in earlier versions though.Ylem
You can still use numbers, just not lone numbers.Underdone
A
15

No Snakecase.

Watch out for underscores as well (not just lone numbers).

ng new my_fantastic_app

Is an invalid name.

And of course as other people have already say , be careful for Lone numbers between dashes

Alixaliza answered 8/8, 2018 at 17:53 Comment(4)
Well I'm not using underscore and dashes works fine.Ylem
I spent 1 hour the other day , before I realize that I was using underscores. :)Alixaliza
Yeah, thanks for sharing the info man but we should edit your answer a bit. This would be helpful for others that will encounter this error with Angular 6.Ylem
Yes thank you Sherwin , it looks better now.I post this answer because a lot of guys like me writing c and c++ , have the habbit to give snakecase names in files , functions , project etc.Alixaliza
U
7

Melchia is correct.

But to be more specific, the problem is the lone number between the dashes.

This will also work:

ng new angular6-boilerplate
Underdone answered 5/8, 2018 at 1:43 Comment(1)
Thanks for the info. I didn't know this could work tooUltrared
S
2

Don't use _ (underscore) sign, use minus - (minus) sign.

For Example:

Wrong code:

ng new naytiv_admin_fe

Right code:

ng new naytiv-admin-fe

Schnell answered 10/4, 2019 at 13:41 Comment(0)
T
1

Do not include any special characters. You can use the hyphen ( - ) instead of it.

Transcript answered 4/3, 2019 at 9:14 Comment(0)
M
0

Number at the end also does not work.

I had to change from

ng new Chapter-4

to

ng new Chapter4

Martyrology answered 27/3, 2019 at 16:25 Comment(0)
M
0

Try to avoid numbers and special characters while giving name of new project of angular. ng new angular-6-boilerplate Changed to --> ng new angulaBoilerplate

Marqueritemarques answered 26/4, 2023 at 4:7 Comment(3)
Actually Angular encourages to add dashes, see their setup guide. Also in general it is possible to use numbers, expect for some special cases. So this answer is quite inaccurate.Intern
Adding dashes never worked for me.Marqueritemarques
I use dashes all the time and they work for me in 95% of the cases.Intern

© 2022 - 2024 — McMap. All rights reserved.