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

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

alexeagle avatar Oct 23 '18 22:10 alexeagle

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.

breningham avatar Oct 24 '18 08:10 breningham

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

alexeagle avatar Oct 24 '18 13:10 alexeagle

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

jvdboom avatar Nov 01 '18 09:11 jvdboom

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

westdabestdb avatar Nov 01 '18 23:11 westdabestdb

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 avatar Nov 02 '18 16:11 SantiPrll

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

westdabestdb avatar Nov 03 '18 23:11 westdabestdb

using @SantiPrll comment it worked for me

unaor avatar Nov 05 '18 13:11 unaor

image

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

SantiPrll avatar Nov 06 '18 01:11 SantiPrll

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?

josalvatorre avatar Nov 07 '18 21:11 josalvatorre

Que versión de node estás utilizando?

SantiPrll avatar Nov 08 '18 02:11 SantiPrll

Que versión de node estás utilizando?

v11.0.0

josalvatorre avatar Nov 08 '18 19:11 josalvatorre

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

StarDrop9 avatar Nov 10 '18 18:11 StarDrop9

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

meysamsahragard avatar Nov 14 '18 08:11 meysamsahragard

node_modules

this solved my issue! thanx

movadee avatar Nov 19 '18 20:11 movadee

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

breningham avatar Nov 19 '18 21:11 breningham

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

StephenWTurner avatar Dec 04 '18 13:12 StephenWTurner

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)

vsanandan avatar Dec 08 '18 02:12 vsanandan

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.

MartinJohns avatar Dec 18 '18 09:12 MartinJohns

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

B1u2Pr0 avatar Jan 17 '19 03:01 B1u2Pr0