Schematic input does not validate against the Schema: {“name”:“testng7”} on Angular 7

≡放荡痞女 提交于 2019-11-28 03:19:11

问题


I updated the Angular CLI to the latest @angular/cli@7.0.2 on a Mac OS. When issuing the command ng new testng7, I get this error:

Schematic input does not validate against the Schema: {"name":"testng7"}
Errors:
  Data path "" should have required property 'version'.

And nothing is created. Any clues how to fix?


回答1:


This error is possible of avoiding naming standards

Project name can not have underscore '_'. It can have dashes '-', small and capital letters and digits.

Valid Project Names

myProject //camel casing style or JavaScript style

MyProject //normal style

MyProject1 //letters and numbers mixed style

My-Project1 //letters, numbers and dash mixed style

Invalid Project Names

MyProject-1 //dash can not be between letter and digit

My_Project //underscore is restricted



回答2:


First, to upgrade, I did this:

npm i -g @angular/cli
npm i @angular/cli

to install globally and locally. Running an npm audit fix revealed there is a problem with a missing package.json in the npm logs - missing from my root directory! So I created one with the following command in my home directory:

npm init --yes

for a default one. Now issuing an ng new projName works.




回答3:


Try the

ng new projectName

cmd in powershell with admin rights. I did it once and after that it works in normal cmd promt too.




回答4:


Try

ng new testng7 --version=7.0.2

It Will Work!!!




回答5:


I was having the same problem

Schematic input does not validate against the Schema: {"name":"DemoProj"}

Errors:

Data path "" should have required property 'version'.

do the following steps to resolve this issue

1) uninstall -g angular-cli

2) npm uninstall --save-dev angular-cli

3) npm install -g @angular/cli@latest

4) npm install --save-dev @angular/cli@latest

5) npm install -g

6) ng new YourProjectName

i hope it will work



来源:https://stackoverflow.com/questions/52972168/schematic-input-does-not-validate-against-the-schema-nametestng7-on-angu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!