Schematic input does not validate against the Schema: {"name":"testng7"} on Angular 7
Solution 1
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.
Solution 2
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
Solution 3
I added this flag to make it work --client-project
ng add @nguniversal/express-engine --client-project=launcher
Solution 4
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
Solution 5
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.
Related videos on Youtube
mohsenmadi
Updated on February 09, 2022Comments
-
mohsenmadi over 2 years
I updated the Angular CLI to the latest
@angular/[email protected]
on a Mac OS. When issuing the commandng 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?
-
Dinidu Hewage about 5 yearsIn my case, It was the '_' which was responsible for this error, After I changing it into '-' it works fine
-
Harkal about 4 yearsthis comment might help someone in future => if you have multiple projects in your angular app then add flag --client-project for example => ng add @nguniversal/express-engine --client-project=project-name
-
-
mohsenmadi over 5 yearsI tried that first of course - but it causes the problem I described. I also wrote about this issue here: stackoverflow.com/questions/52920355/…. It have now added the solution to my problem at least.
-
mohsenmadi over 5 yearsThanks Wasif, but, the errors I had weren't related to mere naming.
-
RahulAN almost 5 yearsAwesome, it was due to "_" i change to "-" it is working now.
-
Claude Martin about 4 yearsI had a similar problem with Angular 8 when trying to
ng add
a package. This resolved the problem.