Search code examples
reactjscreate-react-appnpm-scripts

"Cannot reach this page" npm start


Everything was working well enough before I ran npm start the last time to see my web page in the browser. The issue that I started to encounter repeatedly is-

Firstly, it takes more than 2 minutes to show "starting the development server" and then after taking the same amount of time, all I see is "Cannot reach this page". And that's not all. My whole system hangs there. I can't do anything. Not even the mouse moves.

I re-setup create-react-app thrice, but with the same result. Then I tried npm start on one of my other projects on my system and it worked normally.

I can't suspect my current project setup because this was working all well before this issue arised out of nowhere. Please have a look at the project- codesandbox


Solution

  • Your problem lies in Downloads-Section.scss where there is an infinite loop, since $i never gets incremented. This results in an infinitely long css file compilation which in turn uses too much memory leading to a system shutdown.

    The easiest fix is to use a for instead, since this reduces the chances of this happening again:

            @for $i from 1 through 4 {
                .card#{$i} {
                    grid-area: card#{$i};
                }
            }
    

    https://codesandbox.io/s/project1-3g45p?file=/src/comps/download-section/Download-section.scss:367-444