matt
matt

Reputation: 321

npm audit fix --force causes error: Data path ".builders['app-shell']" should have required property 'class'

I got this message after I installed a package:

added 1 package from 8 contributors and audited 49729 packages in 23.754s
found 25 vulnerabilities (1 low, 24 high)
  run `npm audit fix` to fix them, or `npm audit` for details

So I ran npm audit fix and it fixed some of the vulnerabilities.

...
+ @angular-devkit/[email protected]
+ @angular-devkit/[email protected]
added 125 packages from 72 contributors, updated 8 packages and moved 16 packages in 65.005s
fixed 12 of 25 vulnerabilities in 49729 scanned packages
  3 package updates for 13 vulns involved breaking changes
  (use `npm audit fix --force` to install breaking changes; or refer to `npm audit` for steps to fix these manually)

It suggested use npm audit fix --force, I used it and now when I try run the Angular app it get this error:

Schema validation failed with the following errors:
  Data path ".builders['app-shell']" should have required property 'class'.
Error: Schema validation failed with the following errors:

What is going on, should I be using npm audit fix or ignore the warnings. How can I get my app working again?

It shows this message after I run the force fix but it's too late already ran the command:

npm WARN using --force I sure hope you know what you are doing.

The packages installed:

https://stackblitz.com/edit/typescript-uuubb8

Upvotes: 5

Views: 7572

Answers (1)

MarvinJWendt
MarvinJWendt

Reputation: 2684

Always be careful with the --force flag. It's like shutting down a computer by pulling out the cable. You basically "force" NPM to do what you want it to do, even if NPM knows that your app will crash then.

To fix this you have to revert the changes manually.

You can also try to run npm update. It will update every package (but backup your project before!). Maybe this is enough to fix it.

If you have to fix a vulnerability in the future, do it without the --force flag. If that doesn't work, do it manually by running npm audit: It will show you the details of the issue, without doing anything.

Upvotes: 4

Related Questions