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

ng new fails with "Schematic input does not validate against the Schema"

Open breningham opened this issue 8 years ago • 56 comments

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

breningham avatar Oct 22 '18 13:10 breningham

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',

StephenWTurner avatar Jan 17 '19 09:01 StephenWTurner

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

subbuswaroop avatar Jan 19 '19 08:01 subbuswaroop

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)

Mulperi avatar Jan 24 '19 18:01 Mulperi

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

daton89 avatar Jan 26 '19 14:01 daton89

@meysamsahragard

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

work for me Thanks :)

Rajkumar9386 avatar Jan 30 '19 07:01 Rajkumar9386

@meysamsahragard

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

work for me Thanks :)

Hi dear Rajkumar. You're welcome.

meysamsahragard avatar Jan 30 '19 17:01 meysamsahragard

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

veera001 avatar Feb 04 '19 16:02 veera001

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.

aeros281 avatar Feb 20 '19 00:02 aeros281

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

khandelwalriya avatar Feb 25 '19 06:02 khandelwalriya

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

pacozevallos avatar Mar 04 '19 05:03 pacozevallos

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.

johnmanoahs avatar Mar 05 '19 23:03 johnmanoahs

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

royelias avatar Mar 13 '19 11:03 royelias

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

alexbrtsv avatar Mar 14 '19 12:03 alexbrtsv

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

n8bizall avatar Mar 21 '19 15:03 n8bizall

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

aneeshjoshi avatar Mar 26 '19 02:03 aneeshjoshi

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

rafaelzuckerberg avatar Mar 26 '19 20:03 rafaelzuckerberg

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 avatar Mar 27 '19 08:03 mohanacchu

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

chemc2 avatar Apr 01 '19 19:04 chemc2

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

rafaelzuckerberg avatar Apr 02 '19 04:04 rafaelzuckerberg

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.

farooqahmedkhan avatar Apr 10 '19 06:04 farooqahmedkhan