Solve the prompt "npm audit fix" problem

1. Problems

Recently, I was learning React Native by myself. When I used npm to install some third-party libraries, I found that I always reported errors. For example,
insert image description here
I just want to install react-native-screens and react-native-safe-area-context , but it always reminds me that I must install audit. Not only this library cannot be installed, but I also reported an error
when I installed react-navigation/native
insert image description here
. Looking at the installation prompt, I was given two options, either execute:

npm audit fix

If the execution fails, you can choose to force the installation

npm audit fix --force

These two solutions are huge pits, not only can't solve the problem, but also downloaded a bunch of messy things, which made the original normal project unable to run.

Two, the solution

In fact, audit is a dispensable thing. I didn’t install it when I installed npm, and the project still runs, so just ignore this audit when installing third-party dependencies.
A few examples, for example, I want to install **@react-navigation/native** now, the usual execution command is

npm install @react-navigation/native  

If there is no problem after you execute it, then congratulations, you don’t need to read further. If there is a problem with the implementation, report to audit, you can use the following installation instructions:

npm install @react-navigation/native  --no-fund --no-audit

Pay attention to the following suffix: –no-fund --no-audit , this is the core to solve the problem of installing three-party dependencies on audit. In the future, as long as you encounter problems that require audit, you can add this suffix after the original installation command. The effect is as follows:
insert image description here
it is installed in seconds. Next, try another dependent library installation:
insert image description here
the same is OK.

Guess you like

Origin blog.csdn.net/qq_26439323/article/details/126330485