To fix this issue simply upgrade react-scripts package (check latest version with npm info react-scripts version
):
"react-scripts": "^3.x.x"
with "react-scripts": "^3.4.1"
(or the latest available version)npm install
or yarn install
Some people reported that this issue was caused by running npm audit fix
(avoid it!).
If you have ejected, this is the proper way to fix this issue:
find this file config/webpackDevServer.config.js
and then inside this file find the following line:
app.use(noopServiceWorkerMiddleware());
You should change it to:
app.use(noopServiceWorkerMiddleware('/'));
For me(and probably most of you) the service worker is served at the root of the project. In case it's different for you, you can pass your base path instead.
I've also faced this problem and figure out it by upgrading the react-scripts
package from "react-scripts": "3.x.x"
to "react-scripts": "^3.4.1"
(or the latest available version).
node_modules\
folderpackage-lock.json
filepackage.json
file from "react-scripts": "3.x.x"
to "react-scripts": "^3.4.1"
npm i
npm start
And it works!!
Running npm i [email protected]
solved my issue.
I just had this issue after installing and removing some npm packages and spent almost 5 hours to figure out what was going on.
What I did is basically copied my src/components in a different directory, then removed all the node modules and package-lock.json (if you are running your app in the Docker container, remove images and rebuild it just to be safe); then reset it to my last commit and then put back my src/components then ran npm i
.
I hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With