Angular-cli: ng new fails with "Schematic input does not validate against the Schema"

Created on 22 Oct 2018  ·  56Comments  ·  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [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 Version:

$ node --version
v10.12.0

NPM Version:

$ npm --version
6.4.1

Angular Version:

$ ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 7.0.2
Node: 10.12.0
OS: darwin x64
Angular:
...

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

OS: MacOS Mojave

Repro steps

ng new ng7app

The log given by the failure


Schematic input does not validate against the Schema: {"name":"ng7app"}
Errors:

Data path "" should have required property 'version'.

Desired functionality


I would like to generate a new Angular Workspace.

Mention any other details that might be useful


if i provide a 'version', then i get a different error :

$ ng new ng7app --version 7
Cannot read property 'entries' of undefined
angulacli low broken

Most helpful comment

I had the same error when I used underscores in the new app name instead of hyphens:

npm new my_new_app >>> Fails
npm new my-new-app >>> Succeeds

All 56 comments

This is generally because the CLI found some file like an old angular.json in the current directory or a parent directory. We should improve the error message - for now, try running the ng new command in a different directory or removing some stale files if you can guess which they are...

hi @alexeagle thanks,

i didn't have a rogue angular.json file, but i did have a rogue 'local' install in my Projects folder, must of forgot the -g sometime previously.

Anyway, Seems to have been resolved by removing the unneeded node_modules folder.

@hexl84 your issue is different from the original post. Please keep issues targetted to one thing at a time.

Same here:
ng -version:

 _                      _                 ____ _     ___
/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ △ \ | '_ \ / _| | | | |/ _ | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ __| |_|__, |__,_|_|__,_|_| ____|_____|___|
|___/

Angular CLI: 7.0.3
Node: 11.0.0
OS: win32 x64
Angular:
...

Package Version

@angular-devkit/architect 0.10.3
@angular-devkit/core 7.0.3
@angular-devkit/schematics 7.0.3
@schematics/angular 7.0.3
@schematics/update 0.10.3
rxjs 6.3.3
typescript 3.1.3

**>ng new DemoApp
Schematic input does not validate against the Schema: {"name":"DemoApp"}
Errors:

Data path "" should have required property 'version'.**

Same here ._.

> ng --version

Angular CLI: 7.0.4
Node: 10.7.0
OS: darwin x64
Angular: 
... 
Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.10.4
@angular-devkit/core         7.0.4
@angular-devkit/schematics   7.0.4
@schematics/angular          7.0.4
@schematics/update           0.10.4
rxjs                         6.3.3
typescript                   3.1.3

>bash-3.2$ ng new serv
Schematic input does not validate against the Schema: {"name":"serv"}
Errors:

  Data path "" should have required property 'version'.

Con la nueva actualización del Angular CLI
debes de especificar con que tipo de versión trabajarás

ng new project-name --version=7.0.4
o
ng new project-name --version=7.0.2

Saludos

@SantiPrll Hello, thank you for help but now I get this error.
ng new freeng --version=7.0.2
Could not find (undefined)

using @SantiPrll comment it worked for me

image

@westdabestdb Si te fijas replique tu ejemplo y si trabaja, te recomiendo que resinstalar el CLI de forma global.

As SantiPrII recommended, I reinstalled the angular cli globally. I'm still getting the "Could not find (undefined)" error after running both "ng new angular-website --version=7.0.4" and "ng new angular-website --version=7.0.2".
Does anyone know what "(undefined)" could be referring to?

Que versión de node estás utilizando?

Que versión de node estás utilizando?

v11.0.0

I removed node_modules folder in users/{user name} and ng new [appname] now working.

Hi, For resolve this error uninstall @schematics/angular package or remove @schematics directory from node_modules directory then install a previous version. For example:
npm i @schematics/[email protected] --save-dev

node_modules

this solved my issue! thanx

I'm closing this issue as the original issue has been resolved.

I had the same error when I used underscores in the new app name instead of hyphens:

npm new my_new_app >>> Fails
npm new my-new-app >>> Succeeds

After trying all these things, I get the following error for the command
ng new getrequest --version=7.1.2

Tree type is not supported.

I am trying the above command on CLI.

Some time I get the error: Could not find (undefined)
I tried running as a super user (in Linux)

I had the same error when I used underscores in the new app name instead of hyphens:

I had the same error when one of the name-parts was digits, e.g. prototype-1234. Changing it to prototype-s1234 works. So here it's a case of a bad regex.

Hello, StephenWTurner
Thanks for your comment
Could you tell me the reason why it solves the issue?

Hi B1u2Pr0, I'm not sure it does solve the original issue at all. However, it allows a simple typo to be eliminated before getting unrelated 'me toos',

I was facing the same issue... The problem for me was , I was using an underscore when creating the directory name.
I was using "ng new Test_Angular". Then I changed it to "ng new Test-Angular" and it worked for me

I had the same error when I used underscores in the new app name instead of hyphens:
npm new my_new_app >>> Fails
npm new my-new-app >>> Succeeds

So it was the underscores. This worked for me. Thanks! (Still, it's strange)

in my case using @angular/cli 7.2.3

ng new angular-7-test failed with error

Schematic input does not validate against the Schema: {"name":"angular-7-test","version":"7.2.3","routing":true,"style":"scss"}
Errors:

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

ng new angular7testsuccess

@meysamsahragard

npm i @schematics/[email protected] --save-dev

work for me
Thanks :)

@meysamsahragard

npm i @schematics/[email protected] --save-dev

work for me
Thanks :)

Hi dear Rajkumar. You're welcome.

@SubbuSwaroop Yes. i faced same issue and it was successful after removing uderscore
is there any specific usage for uderscore?

I have the same error creating new project with underscore

ng new angular_wip
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? Sass   [ http://sass-lang.com   ]
Schematic input does not validate against the Schema: {"name":"angular_wip","version":"7.3.2","routing":true,"style":"sass"}
Errors:

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

Anyway to resolve this? It's ridiculous that the project must not contain underscore in order for the cli to successfully initialize the app.

Angular CLI: 6.2.9
Node: 10.15.1
OS: linux x64
Angular:
...

Package Version

@angular-devkit/architect 0.8.9
@angular-devkit/core 0.8.9
@angular-devkit/schematics 0.8.9
@schematics/angular 0.8.9
@schematics/update 0.8.9
rxjs 6.2.2

Schematic input does not validate against the Schema: {"version":"6.2.9","skipGit":false,"experimentalIvy":false,"skipInstall":false,"linkCli":false,"commit":true,"newProjectRoot":"projects","inlineStyle":false,"inlineTemplate":false,"routing":false,"prefix":"app","style":"css","skipTests":false,"createApplication":true,"minimal":false}
Errors:

Data path "" should have required property 'name'.

I removed node_modules folder in users/{user name} and ng new [appname] now working.

Eliminar la carpeta de node_modules funcionó para mí, había quedado un package.json que también lo eliminé.

Angular CLI: 7.3.4
Node: 10.15.2
OS: darwin x64

Apparently if your project name has a "_" or "-" (underscore or hyphen) it tends to throw this error. I removed the special chars and it worked ok.

I had the same error when I used underscores in the new app name instead of hyphens:

npm new my_new_app >>> Fails
npm new my-new-app >>> Succeeds

had same issue and using hyphens instead of underscore worked perfectly

have the sane trouble

npm uninstall -g angular-cli
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest

reinstall helps me

I had this same issue and just had to make it
ng new myApp --version 7.3.6 <-the version of angular I am using

Apparently if your project name has a "_" or "-" (underscore or hyphen) it tends to throw this error. I removed the special chars and it worked ok.

🤦‍♂️ - This worked for me.

Thanks @johnmanoahs

For me, before, I updated npm : "npm update" and after run : "ng new projetc-teste --version=7.3.6"

i'm still facing the same issue.My current angular version is 7.3.6 but error still exist

ng new learn-curve
C:\Users\mohan.n\Desktop\My Help in Angular Nov\angular-learn>ng new learn-curve
Schematic input does not validate against the Schema: {"name":"learn-curve"}
Errors:

Data path "" should have required property 'version'.

i also tried ng new projetc-teste --version=7.3.6
for which i'm getting Cannot read property 'entries' of undefined

angular install error

Please help me out

@mohanacchu try no to use '-' on the name of the project. Something is wrong with newer versions in that regard

Try inside your project to remove node_module and run npm install again

I had the same error when I used underscores in the new app name instead of hyphens:

npm new my_new_app >>> Fails
npm new my-new-app >>> Succeeds

Strange but this actually resolved the schematic issue.

For me, before, I updated npm : "npm update" and after run : "ng new projetc-teste --version=7.3.6"

Thanks, this worked for me.

3 things you should check if you face problem on ng new
1) check the directory name - should not have alphanumeric and special characters.
2) type ng --version in node cmd, check whether all package is clear without showing error on the package version or else install those packages.
3) if cmd shows error on @angular\cli then delete c:\users\usernameAppdata\Roaming\npm\node_modules\@angular\cli and then install it, it will work. if you feel appdata is missing in the folder then it is in hidden, u should do C: -> Organize -> Folder Options -> View -> Hidden files and folder -> Show hidden files.....

Hope this will help you....

3 things you should check if you face problem on ng new

  1. check the directory name - should not have alphanumeric and special characters.
  2. type ng --version in node cmd, check whether all package is clear without showing error on the package version or else install those packages.
  3. if cmd shows error on @angular\cli then delete c:\users\usernameAppdata\Roaming\npm\node_modules@angular\cli and then install it, it will work. if you feel appdata is missing in the folder then it is in hidden, u should do C: -> Organize -> Folder Options -> View -> Hidden files and folder -> Show hidden files.....

Hope this will help you....

mine had alphanumeric. Removed the number and now its working. Ty

HI,
This issue may be resolved by applying the following command in cmd.

npm i @schematics/angular@latest --save-dev

after applying this no need to write version after angular 7 project name just write
ng new ang-project-name

I deleted the -3 at the end of my project name and then it worked. :)

ng new my-project-3 ----> Doesn't work
ng new my-project-three ----> Works

It seems the CLI doesn't like project names that end with a dash/underscore and only digits (e.g app-name-01, app-name_02). Removing the dash/underscore works, ie. app-name01, app-name02.

For me, helped removing ~/package-lock.json (who knows why that file was in my home)

use --clientProject project-name flag work for me

previous CLI version:-- 7.3.8
solution:-- updated CLI version to the latest
use CLI version:- 7.3.9
work for me

In my case i had an app anem like abc-2-xyz. Changing it to abc2xyz resolved the problem.

I was getting this error when I had an _underscore_ sign in my project name. Worked normally after removing it.

Angular CLI: 7.3.8

I had the same error when I used underscores in the new app name instead of hyphens:

npm new my_new_app >>> Fails
npm new my-new-app >>> Succeeds

this one worked fine for me.
Thanks.

Resolved as follows:-

npm uninstall -g @angular/cli
npm uninstall @angular/cli
npm cache verify
npm install -g @angular/cli@next
npm install @angular/cli@next
npm i @schematics/angular@next

first type ng -v
then according to your version install following command
@schematics/[email protected]

I had the same problem with ng new naq_monthly_settlement_report. I fixed it with ng new naq-monthly-settlement-report

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brtnshrdr picture brtnshrdr  ·  3Comments

hareeshav picture hareeshav  ·  3Comments

delasteve picture delasteve  ·  3Comments

hartjo picture hartjo  ·  3Comments

rajjejosefsson picture rajjejosefsson  ·  3Comments