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

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

Thanks, this worked for me.

Cuica20 avatar Apr 12 '19 08:04 Cuica20

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

Sivaneymar07 avatar Apr 19 '19 04:04 Sivaneymar07

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

renanss avatar Apr 24 '19 17:04 renanss

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

yogeshdotnet avatar Apr 29 '19 02:04 yogeshdotnet

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

rafmos avatar Apr 29 '19 15:04 rafmos

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.

crissdev avatar May 05 '19 17:05 crissdev

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

vip9 avatar May 17 '19 09:05 vip9

use --clientProject project-name flag work for me

alikarimii avatar May 20 '19 12:05 alikarimii

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

sagar87966 avatar May 21 '19 08:05 sagar87966

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

iappwebdev avatar May 23 '19 06:05 iappwebdev

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

Nocturnal-2 avatar Jun 13 '19 20:06 Nocturnal-2

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.

inajad avatar Jul 07 '19 19:07 inajad

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

vrathaure avatar Jul 18 '19 16:07 vrathaure

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

Anand-Chavan avatar Jul 24 '19 12:07 Anand-Chavan

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

dsun-ge avatar Sep 09 '19 15:09 dsun-ge

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.