angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Unable to create new project with a number in its name

Open Cammisuli opened this issue 8 years ago • 24 comments

Versions

Angular CLI: 6.0.0
Node: 9.9.0
OS: darwin x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.6.0
@angular-devkit/core         0.6.0
@angular-devkit/schematics   0.6.0
@schematics/angular          0.6.0
@schematics/update           0.6.0
rxjs                         6.1.0
typescript                   2.7.2

Repro steps

  • npm i -g @angular/cli
  • ng new ng-6-playground

Observed behavior

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

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

Desired behavior

Should be able to create a new project using the CLI.

Cammisuli avatar May 03 '18 23:05 Cammisuli

Actually looking into this more, it appears that there's an issue with creating a project with a number in it's name.

If I create a project with ng new ng-playground it works. But as soon as I add a number like ng new ng-6-playground the error in the original post appears.

Cammisuli avatar May 03 '18 23:05 Cammisuli

Just got the same error with an underscore in the project name.

UniQP avatar May 04 '18 15:05 UniQP

That's always been the case. The project name is a html selector, every part of it (split by -s) must start with a letter. This is a restriction we're considering removing with the new workspace but decided to keep the 1.x behaviour the same for now.

hansl avatar May 04 '18 16:05 hansl

It's interesting... I do believe that the error message on Windows 10 Pro is more user friendly than the one on Ubuntu 16.04...

Ubuntu: `Schematic input does not validate against the Schema: {"name":"ng_clean_20180507","version":"6.0.0","newProjectRoot":"projects","skipInstall":false,"linkCli":false,"skipGit":false,"commit":null} Errors:

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

Win10: Project name "ng_clean_20180607" is not valid. New project names must start with a letter, and must contain only alphanumeric characters or dashes. When adding a dash the segment after the dash must also start with a letter. ng_clean_20180607

mattezell avatar May 08 '18 01:05 mattezell

I get the "Schematic input does not validate" error on both Windows 7 and Mac OS X Sierra.

So the friendly message on Windows must , indeed, be a Windows 10 only thing.

brownieboy avatar May 16 '18 00:05 brownieboy

only "abcdEfgHijklmnopQrstuvxyZ" ubuntu 16.04

telomere2018 avatar Jun 01 '18 07:06 telomere2018

@hansl I have the issue putting any project name.

For example, see the console message after I put the command ng new section:

Schematic input does not validate against the Schema: {"name":"section/","version":"6.0.7","newProjectRoot":"projects","skipInstall":false,"linkCli":false,"skipGit":false,"commit":null}
Errors:

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

Ubuntu version: 16.04.4 LTS

My Angular packages details:

Angular CLI: 6.0.7 Node: 8.4.0 OS: linux x64 Angular: ...

Package | Version

@ angular-devkit/architect | 0.6.7 @ angular-devkit/core | 0.6.7 @ angular-devkit/schematics | 0.6.7 @ angular/cli | 6.0.7 @ schematics/angular | 0.6.7 @ schematics/update | 0.6.7 rxjs | 6.2.0 typescript | 2.7.2

victorjatoba avatar Jun 06 '18 13:06 victorjatoba

angular app name rules, there can only be a letter after '-', like app-two. you can not use app-2 as the project name.

junweipan avatar Sep 18 '18 03:09 junweipan

Thanks @junweipan your answer helped me to find solution. Today I installed Angular CLI: 7.0.3 and it threw me the same error.

I renamed the project name removing the underscore and it worked.

kithminijayawardena avatar Oct 28 '18 15:10 kithminijayawardena

seems it doesn't support underline, so make sure your project name not including underline.

clarkshu1016 avatar Nov 08 '18 09:11 clarkshu1016

that is a very nasty bug , better do some workaround i wasted a lot of time figuring out that what was the case at last i have to come to this page and see for myself what all things are allowed . but good to go now :)

Hyperion101010 avatar Dec 09 '18 14:12 Hyperion101010

underscore [ _ ] in name of the project also threw this error

sheecegardezi avatar Dec 10 '18 23:12 sheecegardezi

ng-v6-playground will work!

lchioukh avatar Dec 25 '18 01:12 lchioukh

oui c'est ça la bon réponse merci beaucoup pour cette information

saifeddinhajji avatar Feb 13 '19 14:02 saifeddinhajji

In my case there was an error while I tried to add the project name an underline "_". Once I removed, the command worked.

ghost avatar Feb 27 '19 22:02 ghost

for me 15-puzzle-generator didn't work so I changed it to fifteen-puzzle-generator which did😁 angular cli 7.3.6

jamessouth avatar Mar 17 '19 01:03 jamessouth

Just got the same error with an underscore in the project name.

thank you I got the same error and resolve it

zouzuooo avatar Apr 15 '19 02:04 zouzuooo

almost an year after the underscore issue on project name is still there

antonioaltamura avatar Apr 19 '19 14:04 antonioaltamura

Solve :- https://www.techkhabarnepal.com/2019/04/schematic-input-does-not-validate.html

ghost avatar May 01 '19 05:05 ghost

As of today, the error is still here

Angular CLI: 7.3.9 Node: 11.6.0 OS: darwin x64 Angular: ...

Package Version

@angular-devkit/architect 0.13.9 @angular-devkit/core 7.3.9 @angular-devkit/schematics 7.3.9 @schematics/angular 7.3.9 @schematics/update 0.13.9 rxjs 6.3.3 typescript 3.2.4

gitbaron avatar May 09 '19 03:05 gitbaron