Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
breningham opened this issue Oct 22, 2018 · 56 comments
Closed
Labels
area: @angular/cli freq1: low Only reported by a handful of users who observe it rarely severity3: broken
Milestone

Comments

@breningham
Copy link

breningham commented Oct 22, 2018

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
@alan-agius4 alan-agius4 added freq1: low Only reported by a handful of users who observe it rarely severity3: broken area: @angular/cli labels Oct 23, 2018
@ngbot ngbot bot modified the milestone: needsTriage Oct 23, 2018
@alexeagle
Copy link
Contributor

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

@breningham
Copy link
Author

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.

@alexeagle
Copy link
Contributor

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

@alexeagle alexeagle changed the title Unable to Generate new Angular Workspace with @angular/cli version 7.0.2 ng new fails with "Schematic input does not validate against the Schema" Oct 24, 2018
@jvdboom
Copy link

jvdboom commented Nov 1, 2018

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

@westdabestdb
Copy link

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

@SantiPrll
Copy link

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

@westdabestdb
Copy link

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

@unaor
Copy link

unaor commented Nov 5, 2018

using @SantiPrll comment it worked for me

@SantiPrll
Copy link

image

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

@josalvatorre
Copy link

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?

@SantiPrll
Copy link

Que versión de node estás utilizando?

@josalvatorre
Copy link

Que versión de node estás utilizando?

v11.0.0

@StarDrop9
Copy link

StarDrop9 commented Nov 10, 2018

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

@meysamsahragard
Copy link

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

@movadee
Copy link

movadee commented Nov 19, 2018

node_modules

this solved my issue! thanx

@breningham
Copy link
Author

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

@StephenWTurner
Copy link

StephenWTurner commented Dec 4, 2018

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

@vsanandan
Copy link

vsanandan commented Dec 8, 2018

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)

@MartinJohns
Copy link

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.

@B1u2Pr0
Copy link

B1u2Pr0 commented Jan 17, 2019

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

@StephenWTurner
Copy link

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

@subbuswaroop
Copy link

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

@aeros281
Copy link

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.

@khandelwalriya
Copy link

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

@pacozevallos
Copy link

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

@johnmanoahs
Copy link

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.

@royelias
Copy link

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

@alexbrtsv
Copy link

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

@n8bizall
Copy link

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

@aneeshjoshi
Copy link

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

@rafaelzuckerberg
Copy link

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

@mohanacchu
Copy link

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

@chemc2
Copy link

chemc2 commented Apr 1, 2019

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

@rafaelzuckerberg
Copy link

rafaelzuckerberg commented Apr 2, 2019

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

@farooqahmedkhan
Copy link

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.

@Cuica20
Copy link

Cuica20 commented Apr 12, 2019

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

Thanks, this worked for me.

@Sivaneymar07
Copy link

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\username\Appdata\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....

@renanss
Copy link

renanss commented Apr 24, 2019

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\username\Appdata\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

@yogeshdotnet
Copy link

yogeshdotnet commented Apr 29, 2019

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

@rafmos
Copy link

rafmos commented Apr 29, 2019

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

@crissdev
Copy link

crissdev commented May 5, 2019

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.

@vip9
Copy link

vip9 commented May 17, 2019

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

@alikarimii
Copy link

use --clientProject project-name flag work for me

@sagar87966
Copy link

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

@iappwebdev
Copy link

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

@Nocturnal-2
Copy link

Nocturnal-2 commented Jun 13, 2019

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

@inajad
Copy link

inajad commented Jul 7, 2019

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.

@vrathaure
Copy link

vrathaure commented Jul 18, 2019

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

@Anand-Chavan
Copy link

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

@dsun-ge
Copy link

dsun-ge commented Sep 9, 2019

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

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @angular/cli freq1: low Only reported by a handful of users who observe it rarely severity3: broken
Projects
None yet
Development

No branches or pull requests