React app won't run after npm fix audit --force

64 Views Asked by At

I installed react-scroll library via 'npm install react-scroll' and after that I also run 'npm fix audit --force' to fix some vulnerabilities. That results in my app not running again. I tried some fixes here still struggling to fix the issue. I need help .

I tried pasting this

const crypto = require("crypto"); const crypto_orig_createHash = crypto.createHash; crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);

in node_modules\react-scripts\config\webpack.config.js

Now the app is saying it cannot compile

2

There are 2 best solutions below

0
On

I think the best solution I found which fixed the problem is to remove the node_modules folder and run npm install.

4
On

I got an error called "This site can't be reached" after executing npm fix audit --force when installing Ant Design into VS Code. So, I tried a couple of things but none of them worked.

  • The used Environment is Node.js and the Library is React.

So, I downgraded the Node.js to version 16 and it fixed my problem.