Everything worked fine yesterday morning. But in the evening, this unexpected error appeared for the first time when I tried npm start
on the client.
I tried to fix the issue following some suggestions I found after searching. I deleted the node_modules
folder and package-lock.json
file and executed npm i
once again, thus re-installing all dependencies. It showed this:
The previous error still persisted. Following the instruction, I executed npm audit fix --force
, and the only change that I noticed it made was upgrading react-scripts
to version 5.0.0
from 4.0,3
. This fixed the previous error, and now the code compiles well :
However, on opening localhost:3000
it shows connection refused :
So, I am still unable to access the development server.
An interesting fact is that on executing npm run build
, the build completes successfully. This exact client side code is also successfully hosted on netlify right now. So I hope my code and syntax is working fine. But I am unable to find why I am facing error in development mode.
node version v16.6.1
npm version 7.20.3
OS: Windows 11
It would be really nice if someone could clone this repo in their device and try running npm start
in the client folder (after installing the dependencies with npm install
), and check if they face the issue as well.
As mentioned before, the build occurs successfully even with react-scripts version 4.0.3
. The development server was also running fine in the morning. But it suddenly didn't work in the evening although I had made no changes to the code.