Hi Devs,
I am new to react. Need advice.
I am a windows user. I couldn't run the website initially. I got 'PORT' is not recognized error.
To fix it I did these:
It started working. Can you please advise is it correct or not? And how do we make this work both in Linux as well as Windows?
Thanks
Mani
I was also facing the same problem this is how i resolved it. On windows you can simply start by
npm install -D to install all the required dependenciesnpm run build to build the project.npm install -g serve to serve the project on browserserve -s build and this will generate localhost address.I tried the same in ubuntu 18.04 LTS
The server is running but the browser responds
404 the requested path cannot be found
Any solution to this?
Thanks, @SanjeevYadavcr7. I am able to run it through this approach but it lost the instant updates (hot reload) feature. Whenever I make any changes I need to rebuild again which takes some time.
I tried the same in ubuntu 18.04 LTS
The server is running but the browser responds
404 the requested path cannot be foundAny solution to this?
In Linux you can just do this
npm i && npm start
This error comes up

Added the installation method for windows in readme.
PR: https://github.com/covid19india/covid19india-react/pull/177
This error comes up
Did you run npm install ?
yes
In package.json under scripts -> start replace existing command to following
SET PORT=3001 && react-scripts start css-watch
But I guess this may not work in Linux.
The best solution for this is that we can create an .env file in the root of our application and set the PORT environment variable as 3001 there. That way we can run this app in both Linux and windows system. I can share a PR if required.
Closed since future revision of codebase wouldn't require setting the port.
Most helpful comment
I was also facing the same problem this is how i resolved it. On windows you can simply start by
npm install -Dto install all the required dependenciesnpm run buildto build the project.npm install -g serveto serve the project on browserserve -s buildand this will generate localhost address.