React app stuck on "Starting the development server"

ReactjsNpmCreate React-AppReact Scripts

Reactjs Problem Overview


I have a react app created by create-react-app. After running npm start (the start script is present in package.json as "start": "react-scripts start") the console says Starting the development server as usual and fires up the browser. But after this both the console and the browser do absolutely nothing indefinitely. No error or output. It simply does nothing.

Reactjs Solutions


Solution 1 - Reactjs

I have something similar happening to me.

I have a react project that I want to convert to Typescript and I started as you noted with the "create-react-app", added all my files and hoped for the best - but got stuck like you on the “Starting the development server” message.

I have an 8GB Ram with Windows 10 and once I used the default "npm start" for the first time I've seen the node process uses a lot of memory - So I tried to give it more and at the same time I tired to change the port react uses.

  1. Added this to the start script in package.json:

"scripts": { "start": "PORT=3001 react-scripts --max_old_space_size=8128 start", ... }

  1. Closed all my chrome browsers (they take pretty much memory)
  2. And gave it around 1 minute to run

After 1 minute it started working and from that point it just starts quickly and not uses as much memory and not depended on the port I choose

In my case - I guess the first time you run "npm start" on the React Typescript project it probably index the files (or does something similar - I'm not sure and probably need to read about it - I'm new to typescript) which take a lot of memory.

In your case - It might be something similar

Hope it helps :)

Solution 2 - Reactjs

Check This Tow points

  1. Run npm install command before you start the server.

Then also it is not running , please try the second command

  1. Remove the node modules and run npm install once again.

If these two points didn't work , Please provide the screenshot for further analysis.

Solution 3 - Reactjs

First time you run the command it takes about 5 minutes before the page loads.

Solution 4 - Reactjs

I created my react app by create-react-app too.

I've tried all the method mentioned above. But it didn't work for me.

Then I accidentally found out if you have unused import or any unused statements. You will stuck.

My react version is 17.0.1.

Solution 5 - Reactjs

Make sure that your dependencies in package.json includes the following:

"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "3.3.0"

And scripts to be:

"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
}

Once you ensure that, you can follow the following steps:

1. npm install
2. npm run build
3. npm start

Hope will works for you.

Solution 6 - Reactjs

the same problem as i met; npm start but got stuck like you on the “Starting the development server” message. after i trying the following ways but didn't worked:

  1. npm install
  2. npm run build
  3. npm start

it seems not the version matter.

finally, i recheck my code, and found the mistake that's the cause of development server fail to start:

useEffect()

this is the hook incorrect using, maybe i forgot to finish it; then i fixed it, and npm run start, it worked, server started successfully.

Solution 7 - Reactjs

For me, the problem was the name of the parent directory. For some reason it choked on "#" when I tried to install into a directory named "#TEMP". Switched to another directory with success.

This has previously worked on my old MBP i9, I'm now on a MBP M1 Monterey 12.2.1.

Solution 8 - Reactjs

Finally solved this. For me the issue lay in my webpack configuration. I had a webpack alias in there whose alias name was the same as the name of my npm package.

i.e. My package.json had the following at top.

"name": "@mycompany/react-common-components"

Within my webpack.config.js I had

alias: {
        '@mycompany/react-common-components': path.resolve(__dirname, '../src/components')
      },

Once I changed the webpack alias to the following everything worked fine

alias: {
        'react-common-components': path.resolve(__dirname, '../src/components')
      },

Solution 9 - Reactjs

I believe you may have some issues with Node and npm. I would recommend checking the versions first - you’ll need to have Node >= 8.10 and npm >= 5.6 on your machine, and update if needed. It could worth trying to reinstall node.

Checking into node logs could provide some clues on your issue (more information on how to log here)

Solution 10 - Reactjs

I was also having the same issue. Try installing a previous version of react-scripts.

npm install react-scripts@2.1.8

Hope this helps!

Solution 11 - Reactjs

had the same issue, I had to build it first

npm build then npm start

I was running react on my Mac and had to give permission for the terminal to interact with chrome before it worked.

Solution 12 - Reactjs

For me the issue was that I had .css files.

I renamed my css files to .scss and it works.

For some reason create-react-app chokes on CSS files for me.

Weird.

Solution 13 - Reactjs

My team also faced this same issue but we managed to solve it.

  • Run npm install to update packages

  • then run npm audit fix to fix vulnerabilities

  • Finally close all browser tab to free up RAM. I have seen node processes take a significant amount of memory.

  • Run npm start and the development server spins up within a minute or two.


NOTE

Make sure that your dependencies in package.json includes the following:

"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "3.3.0"

And scripts to be:

"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
}

Once you ensure that, you can follow the steps given above.

Solution 14 - Reactjs

I ran into this issue. In my case, there was an .eslintcache file that had incorrect information in it, and was causing an issue. Simply deleting the file solved it for me.

Solution 15 - Reactjs

For me, it was because of using StrictMode, the server starts, but the app keeps loading for a long period.

Solution 16 - Reactjs

This is my react version: "react": "^17.0.2", "react-dom": "^17.0.2", "react-scripts": "4.0.3",

My node version is 12.18.1, and it didn't work. I try to change the version to 14.15.0, and then run success.

Solution 17 - Reactjs

This is my case. In my react app project I configured eslint with

https://github.com/prettier/eslint-plugin-prettier

After removing minimized source file(in my case, mapbox-gl.js) from the source tree, everything works.

Solution 18 - Reactjs

Here are tow points checked:

  1. Remove package.lock and node_modules, re-install: npm i.
  2. Check the node version. Maybe you currently use version is 12.0.0, but this project limited 14.0.0.

Solution 19 - Reactjs

I had similar issue. I just opened chrome to check if it's actually running on there (chrome is my default browser for vs code) and npm could then run the next step after that. So try opening the browser if you're stuck on "starting dev...."

Solution 20 - Reactjs

This is not so much an answer as how to fix the problem in all cases since I think there are likely multiple things that affect this.

Following the ticket here https://github.com/facebook/create-react-app/issues/12090 allowed me to track down the issue to being something to do with the chunks within the bundles having the same file name.

Solution 21 - Reactjs

I was getting timeouts on yarn install and after that worked, getting stuck on Starting development server... which it never did before on this computer.

It may have to do that I am not in the USA, so I set my VPN to Los Angeles and deleted the yarn lock file and the node_modules directory, re-ran yarn install and ran yarn start and everything worked!

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionkenneth-rebelloView Question on Stackoverflow
Solution 1 - ReactjsSharon LifshitsView Answer on Stackoverflow
Solution 2 - ReactjsJerrin stephenView Answer on Stackoverflow
Solution 3 - ReactjsRichard Vartan MelkonianView Answer on Stackoverflow
Solution 4 - ReactjsdrlingyiView Answer on Stackoverflow
Solution 5 - ReactjsMuhammad ZeeshanView Answer on Stackoverflow
Solution 6 - ReactjsJ锋_View Answer on Stackoverflow
Solution 7 - ReactjsSnyggView Answer on Stackoverflow
Solution 8 - ReactjsSimon LongView Answer on Stackoverflow
Solution 9 - ReactjsDan Ovidiu BoncutView Answer on Stackoverflow
Solution 10 - ReactjsTayyab FeroziView Answer on Stackoverflow
Solution 11 - ReactjsBluephlameView Answer on Stackoverflow
Solution 12 - ReactjsOliver WatkinsView Answer on Stackoverflow
Solution 13 - ReactjsashuvssutView Answer on Stackoverflow
Solution 14 - ReactjsBronzdragonView Answer on Stackoverflow
Solution 15 - ReactjsMarwen AouitiView Answer on Stackoverflow
Solution 16 - ReactjsWright WuView Answer on Stackoverflow
Solution 17 - ReactjsZhefengJinView Answer on Stackoverflow
Solution 18 - Reactjswenxuan fengView Answer on Stackoverflow
Solution 19 - ReactjsAryan MehtaView Answer on Stackoverflow
Solution 20 - ReactjsbuggedcomView Answer on Stackoverflow
Solution 21 - ReactjsIanView Answer on Stackoverflow