Skip to content

ng new throw error Schematic input does not validate against the Schema #20718

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

Closed
1 of 15 tasks
robertIsaac opened this issue May 7, 2021 · 6 comments · Fixed by #20727
Closed
1 of 15 tasks

ng new throw error Schematic input does not validate against the Schema #20718

robertIsaac opened this issue May 7, 2021 · 6 comments · Fixed by #20727
Labels
area: @angular/cli freq1: low Only reported by a handful of users who observe it rarely severity2: inconvenient type: bug/fix
Milestone

Comments

@robertIsaac
Copy link

robertIsaac commented May 7, 2021

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was angular 11

Description

after upgrading global angular to 12.0.0-rc.2 to test the new Angular, I can't create new projects whatever I do

🔬 Minimal Reproduction

just try ng new ng12 --defaults

I also tried
ng new ng12 --routing --style=scss
and only ng new and gave these answers

> ng new
? What name would you like to use for the new workspace and initial project? ng12
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? SCSS   [ https://sass-lang.com/documentation/syntax#scss                ]

🔥 Exception or Error


Schematic input does not validate against the Schema: {"styleext":"scss","name":"app","selector":"app-root","flat":true,"path":"/src/app","skipImport":true,"project":"ng12","skipTests":false,"style":"scss"}
Errors:

  Data path "" must NOT have additional properties(styleext).

🌍 Your Environment


> ng version

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


Angular CLI: 12.0.0-rc.2
Node: 14.16.1
Package Manager: npm 6.14.13
OS: win32 x64

Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1200.0-rc.2 (cli-only)
@angular-devkit/core         12.0.0-rc.2 (cli-only)
@angular-devkit/schematics   12.0.0-rc.2 (cli-only)
@schematics/angular          12.0.0-rc.2 (cli-only)

Anything else relevant?

no

@alan-agius4
Copy link
Collaborator

Do you a global Angular cli configuration by any chance?

It looks like you might have a old option present (styleext).

@alan-agius4 alan-agius4 added the needs: more info Reporter must clarify the issue label May 7, 2021
@robertIsaac
Copy link
Author

robertIsaac commented May 7, 2021

@alan-agius4
you are right

> ng config --global
{
  "version": 1,
  "cli": {
    "analytics": false
  },
  "schematics": {
    "@schematics/angular:component": {
      "styleext": "scss"
    }
  }
}

I think I was trying to make the default style SCSS not CSS
but I don't even remember I have done it, and it was working fine in angular 11

and I can't find a way to remove it 🤷‍♂️

@alan-agius4
Copy link
Collaborator

alan-agius4 commented May 8, 2021

You can delete/amend.angular-config.json which is under your home directory.

You can also use

ng config -g schematics undefined

@robertIsaac
Copy link
Author

robertIsaac commented May 8, 2021

running that command throw error

> ng config -g schematics undefined
An unhandled exception occurred: Invalid Path.
See "C:\Users\rober\AppData\Local\Temp\ng-Wfw3qF\angular-errors.log" for further details.

here is this file content

[error] Error: Invalid Path.
    at ConfigCommand.set (C:\Users\rober\AppData\Roaming\npm\node_modules\@angular\cli\commands\config-impl.js:126:19)
    at ConfigCommand.run (C:\Users\rober\AppData\Roaming\npm\node_modules\@angular\cli\commands\config-impl.js:95:25)
    at ConfigCommand.validateAndRun (C:\Users\rober\AppData\Roaming\npm\node_modules\@angular\cli\models\command.js:136:33)
    at async Object.runCommand (C:\Users\rober\AppData\Roaming\npm\node_modules\@angular\cli\models\command-runner.js:205:24)
    at async default_1 (C:\Users\rober\AppData\Roaming\npm\node_modules\@angular\cli\lib\cli\index.js:70:31)

editing .angular-config.json seems the only valid option for removing config

@robertIsaac
Copy link
Author

robertIsaac commented May 9, 2021

i tried to set it again to correct value using ng config -g schematics.@schematics/angular:component.style "scss" and then to remove it but nothing works

PS C:\Users\rober> ng config -g schematics.@schematics/angular:component.style undefined
Schema validation failed with the following errors:
  Data path "/schematics/@schematics~1angular:component/style" must be equal to one of the allowed values.
PS C:\Users\rober> ng config -g schematics.@schematics/angular:component undefined
Schema validation failed with the following errors:
  Data path "/schematics/@schematics~1angular:component" must be object.
PS C:\Users\rober> ng config -g schematics undefined
An unhandled exception occurred: Invalid Path.
See "C:\Users\rober\AppData\Local\Temp\ng-maVvwh\angular-errors.log" for further details.

@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 Jun 10, 2021
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 severity2: inconvenient type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants