Skip to content
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

How to fix Vulnerability in react-scripts #11166

Closed
LiamK021 opened this issue Jul 1, 2021 · 3 comments
Closed

How to fix Vulnerability in react-scripts #11166

LiamK021 opened this issue Jul 1, 2021 · 3 comments

Comments

@LiamK021
Copy link

LiamK021 commented Jul 1, 2021

Hi,
I have worked with React projects, and I have 9 vulnerabilities when I run npm command npm audit command
And when I run the command npm audit fix, it doesn't fix those vulnerabilities.
image

I have googled and found that some answers.
For example:
To fix optimize-css-assets-webpack-plugin pulgin: I need to update to version 5.0.6 from 5.0.4

But how can this npm module is only listed in package-lock.json (as in the required npm module of react-scripts) but not in package.json

Please help me how to upgrade optimize-css-assets-webpack-plugin npm module?
And is there any other way to fix these vulnerabilities?

@akachi1409
Copy link

Hi, Liam
I have had the same error and tried to find out the solution.

I have found that yarn is better than npm in dependency management, so I have used yarn to install the npm package and add the following code to the package.json file.

image

And if you run yarn audit command, you can check the result.

@LiamK021
Copy link
Author

LiamK021 commented Jul 2, 2021

Thanks, trusteddev1325
It has some warnings but removed all the vulnerabilites.

@gaearon
Copy link
Contributor

gaearon commented Jul 2, 2021

These warnings are false positives. There are no actual vulnerabilities affecting your app here.

To fix npm audit warnings, move react-scripts from dependencies to devDependencies in your package.json.

That will remove the false positive warnings.

I agree with the point in #11102 and will make this change so that new projects don't keep having these false positive warnings.

If you want to discuss this, please comment in #11102.

@gaearon gaearon closed this as completed Jul 2, 2021
@facebook facebook locked as resolved and limited conversation to collaborators Jul 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants