angular-cli: Unable to create new project with a number in its name
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.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 15
- Comments: 24 (1 by maintainers)
Just got the same error with an underscore in the project name.
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 likeng new ng-6-playground
the error in the original post appears.angular app name rules, there can only be a letter after ‘-’, like app-two. you can not use app-2 as the project name.
underscore [ _ ] in name of the project also threw this error
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.seems it doesn’t support underline, so make sure your project name not including underline.
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
It seems that “_” is the main culprit… I removed and was able to create a new project.
ng-v6-playground will work!
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.
only “abcdEfgHijklmnopQrstuvxyZ” ubuntu 16.04