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

Error while trying to start the react development server on local device #1

Closed
DevRish opened this issue Mar 18, 2022 · 2 comments
Closed

Comments

@DevRish
Copy link
Owner

DevRish commented Mar 18, 2022

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.

error_1

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:

npm_i

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 :

compiled_success

However, on opening localhost:3000 it shows connection refused :

error_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.

@DevRish
Copy link
Owner Author

DevRish commented Mar 19, 2022

Update: The issue is solved after removing the setupProxy.js file. There was something wrong in that file that was causing the error. I haven't figured what was wrong yet, but I have achieved the proxying functionality by adding "proxy":"http://localhost:5000" to the package.json file. This alternative way of proxying works fine.

@DevRish DevRish closed this as completed Mar 19, 2022
@zijianjoy
Copy link

Are you able to set proxy in package.json? We are encountering this issue facebook/create-react-app#11762 which will fail when defining proxy in package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants