gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.21k stars 10.33k forks source link

Develop process stuck on "compile gatsby files" step #35606

Closed stevepepple closed 2 years ago

stevepepple commented 2 years ago

Preliminary Checks

Description

I'm upgrading Gatsby to 4.13 and when I run gatsby develop the process doesn't go past the compile gatsby files step.

Reproduction Link

https://github.com/Vibemap/gatsby-wordpress-starter

Steps to Reproduce

  1. Updated to 4.13.x and React 18
  2. Run gatsby develop
  3. ...

Expected Result

gatsby-node runs

Actual Result

Process is stuck on "compile gatsby files" step

Environment

System:
    OS: Linux 5.4 Debian GNU/Linux 10 (buster) 10 (buster)
    CPU: (8) x64 Intel(R) Xeon(R) Platinum 8168 CPU @ 2.70GHz
    Shell: 5.0.3 - /bin/bash
  Binaries:
    Node: 14.18.1 - /usr/local/bin/node
    Yarn: 1.22.18 - /usr/local/share/npm-global/bin/yarn
    npm: 6.14.15 - /usr/local/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    gatsby: ^4.13.1 => 4.13.1
    gatsby-background-image: ^1.6.0 => 1.6.0
    gatsby-gravityforms-component: ^3.1.1 => 3.1.1
    gatsby-plugin-build-date: ^1.0.0 => 1.0.0
    gatsby-plugin-client-side-redirect: ^1.1.0 => 1.1.0
    gatsby-plugin-copy-files: ^1.1.0 => 1.1.0
    gatsby-plugin-facebook-pixel: ^1.0.8 => 1.0.8
    gatsby-plugin-feed: ^4.13.0 => 4.13.0
    gatsby-plugin-gatsby-cloud: ^3.2.0 => 3.2.1
    gatsby-plugin-google-amp: ^1.0.4 => 1.0.4
    gatsby-plugin-google-analytics: ^4.13.0 => 4.13.0
    gatsby-plugin-google-tagmanager-timeout: ^2.2.5 => 2.2.5
    gatsby-plugin-image: ^2.6.0 => 2.13.0
    gatsby-plugin-inspector: ^1.0.1 => 1.0.2
    gatsby-plugin-layout: ^3.13.0 => 3.13.0
    gatsby-plugin-loadable-components-ssr: ^4.2.0 => 4.2.0
    gatsby-plugin-manifest: ^4.13.0 => 4.13.0
    gatsby-plugin-minify: ^0.4.0 => 0.4.0
    gatsby-plugin-minify-html: ^1.0.4 => 1.0.4
    gatsby-plugin-netlify: ^4.1.0 => 4.3.1
    gatsby-plugin-nprogress: ^4.13.0 => 4.13.0
    gatsby-plugin-perf-budgets: ^0.0.18 => 0.0.18
    gatsby-plugin-preconnect: ^1.2.1 => 1.3.0
    gatsby-plugin-purgecss: ^6.1.2 => 6.1.2
    gatsby-plugin-react-helmet: ^5.13.0 => 5.13.0
    gatsby-plugin-react-helmet-canonical-urls: ^1.4.0 => 1.4.0
    gatsby-plugin-react-i18next: ^1.2.2 => 1.2.3
    gatsby-plugin-react-svg: ^3.1.0 => 3.1.0
    gatsby-plugin-remove-trailing-slashes: ^4.13.0 => 4.13.0
    gatsby-plugin-resolve-src: ^2.1.0 => 2.1.0
    gatsby-plugin-robots-txt: ^1.7.1 => 1.7.1
    gatsby-plugin-sass: ^5.7.0 => 5.13.0
    gatsby-plugin-sass-resources: ^2.0.0 => 2.0.0
    gatsby-plugin-sharp: ^4.13.0 => 4.13.0
    gatsby-plugin-sitemap: ^5.13.0 => 5.13.0
    gatsby-plugin-split-css: ^2.0.2 => 2.0.2
    gatsby-plugin-use-query-params: ^1.0.1 => 1.0.1
    gatsby-plugin-webpack-bundle-analyser-v2: ^1.1.27 => 1.1.27
    gatsby-plugin-why-did-you-render: ^2.0.0 => 2.0.0
    gatsby-plugin-zopfli: ^2.0.0 => 2.0.0
    gatsby-source-filesystem: ^4.13.0 => 4.13.0
    gatsby-source-gravityforms: ^1.0.17 => 1.0.18
    gatsby-source-wordpress: ^6.13.0 => 6.13.0
    gatsby-transformer-sharp: ^3.14.0 => 3.14.0

Config Flags

FAST_DEV: true, DEV_SSR: false, PARALLEL_SOURCING: true,

LekoArts commented 2 years ago

Unfortunately I can't reproduce with the reproduction you shared. Did you try a gatsby clean before a build? Can you share your project if it differs from the starter?

stevepepple commented 2 years ago

Thanks for checking @LekoArts, I think it does happen intermittently for me in the starter, but appears to be a VS Code and Github Code, specific issue:

Even though I've removed the debug option from Gatsby and config from VS Code the develop process still attaches to a debugger like so:

$ cross-env GATSBY_ENV=staging gatsby develop -H 0.0.0.0 -p 8080 Environment: staging GraphQL Endpoint: https://cms.vibemap.com/graphql

Debugger listening on ws://127.0.0.1:53240/e98a2053-92c0-4e54-911d-7b0a6ce204a9
For help, see: https://nodejs.org/en/docs/inspector
Debugger listening on ws://127.0.0.1:53300/87a703b9-7950-4fba-a345-77e2b12b0386
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Debugger attached.
info GATSBY_EXPERIMENTAL_QUERY_CONCURRENCY: Running with concurrency set to `16`
⠇ compile gatsby files

About 50% of the time in hangs on compile, but the debugger doesn't hit a break point or exception. This didn't happen in earlier versions of Gatsby

LekoArts commented 2 years ago

Well, we didn't add a debugger to Gatsby. What happens when you just run gatsby develop in your terminal? We can't influence your VSCode setup.

stevepepple commented 2 years ago

Right, @LekoArts, it does seem to be an odd issue in my VSCode environment where the --inspect flag was auto-added, regardless of the NPM script command. So not a Gatsby issue.

Why the debugger stopped working as 4.13 is still a question, but I also assume not a Gatsby issue.

LekoArts commented 2 years ago

Okay, thanks for the info!

XdGoldenTigerOfficial commented 1 year ago

I am having the same problem. When running npm run develop/npm start, It doesnt go past the compile gatsby files stage. Does anyone have a fix for this? This is a new project, No changes to anything.

ipavlushin commented 1 year ago

I am having the same problem. When running npm run develop/npm start, It doesnt go past the compile gatsby files stage. Does anyone have a fix for this? This is a new project, No changes to anything.

Did you try gatsby clean or delete .cache folder?

alexniver commented 1 year ago

I have same issue.

I suspend my system, and go to sleep. when I wakeup, wake computer, try gatsby develop the compile stuck forever

2022-12-29_08-27

reboot system fixed the problem.

Megajin commented 1 year ago

Hey everyone, I had the exact same issue but was able to find the cause of it!

First of all my setup:

Gatsby did suddenly start hanging in the compile process without further proceeding. The verbose flag didn't tell me anything neither. However I was able to reverse all steps until I did figure out what happened.

Because of the firebase node app, I was in need for softlink of my root node_modules. I did this because I didn't want to install my packages twice, which is a shame that firebase can't be integrated easily. Anyway I did create the link like this:

mklink /D apps/firebase-functions-folder/node_modules root-project/node_modules (windows)

After that I was still able to compile everyhting. But after a restart of my system everything hang up in the gatsby compile process. After deleting the softlink everything went to normal.

Out of curiosity I did try this on a Linux Distro (Zorin OS) and as expected everything worked normal.

I did start all of my apps like this:

I am pretty sure that on Windows something with the softlink will cause a hang up. Hope this helps anyone with the same problem.