gatsbyjs / gatsby

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

Gatsby develop stuck on Windows 10 #25216

Closed mimiza closed 2 years ago

mimiza commented 4 years ago

Hello guys. I used Solus OS (linux) and gatsby worked just fine without any problem. Now I'm using Windows 10 (x64). Everything I type "gatsby develop" the first time after turning on my computer, it stucks right here:

success write out requires - 0.116s
success write out redirect data - 0.016s
⠋ onPostBootstrap
⠋ Build manifest and related icons

And I have to Ctrl+C and then "gatsby develop" again and it works. Always stucks at the first time.

madalynrose commented 4 years ago

Hi @mimiza!

Sorry to hear you're running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you're able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it.

If you're up for it, we'd very much appreciate if you could provide a minimal reproduction and we'll be able to take another look.

Additionally, it would be helpful to know more about your environment (e.g. which terminal application you are using, which editor, etc.) in order to help locate the bug.

Thanks for using Gatsby! 💜

mimiza commented 4 years ago

@madalynrose Hi there! Please clone this repo https://github.com/mimiza/mimiza.com I'm using Windows 10 (x64), my editor is VSCode. Thank you so much for your response.

wardpeet commented 4 years ago

Hey @mimiza.

I could reproduce this one but I don't really know the reason why this happens. Maybe it's the svg 🤷 When I add console.log inside the plugin, everything works as expected.

@moonmeister do you know of any race conditions that can occur here?

moonmeister commented 4 years ago

I'm not aware of anything off hand but possible. Maybe file system related too. If I get a chance I'll do some testing now that I have a windows machine.

mimiza commented 4 years ago

@wardpeet @moonmeister thank you for supporting. But if it was about svg, why would Linux work?

moonmeister commented 4 years ago

Okay, this is silly, but it's happened twice to me. When it hangs, hit "enter" (you may have to wait a bit?). Yarn and gatsby dev "froze"on me, it seems to be working in the background, but not updating the terminal. Hitting "enter" makes it spit out the missing text and continue to work. Let me know if this works for you.

MeilleurExcellentOptimal commented 4 years ago

I have exactly the same issue as @mimiza.

moonmeister commented 4 years ago

SInce my initial testing I've been doing more windows dev and run into this issue as well. I'm not convinced the bug is in gatsby-source-manifest but that is where it seems to pause consistently. While subsequent runs seem slightly more consistent for me, it seems to hang randomly.

ediblecode commented 4 years ago

I've also had this issue, but via gatsby build, not just via gatsby develop as the issue says, just in case the 'develop' bit is a red herring for someone looking into this. The workaround of pressing a key to 'flush' the console doesn't work in my case I'm using a vscode task.

dkocich commented 4 years ago

This issue happened to me while I used default starter, removed gatsby-icon.png from the project, used my own icon but did not change it in gatsby-config.js (settings of ... resolve: gatsby-plugin-manifest, options { src: 'src/images/myNewIcon-icon.jpg'}...)

edardev commented 4 years ago

Hello guys. I used Solus OS (linux) and gatsby worked just fine without any problem. Now I'm using Windows 10 (x64). Everything I type "gatsby develop" the first time after turning on my computer, it stucks right here:

success write out requires - 0.116s
success write out redirect data - 0.016s
⠋ onPostBootstrap
⠋ Build manifest and related icons

And I have to Ctrl+C and then "gatsby develop" again and it works. Always stucks at the first time.

My solution was;

  1. Update the gatsby-cli and nodejs if possible.

  2. Remove the node_modules, .cache, the public folder and the yarn.lock or package-lock.json files.

  3. I believe the sharp or the pngquant libraries need some processing power to compress your images and icons, to free some resources you could kills some apps or processes running on your machine using Task manager on Windows OS, for example Google Chrome or any other apps consuming resources on your CPU and Memory then try to run yarn install and gatsby develop and it did worked for me.

jordan-git commented 4 years ago

This is happening to me now too. Repository. It started happening a little before my current commit, but I was able to get around it by running the command again so I kept working. My page seems to have gotten slower and to the point where the JS breaks with my most recent addition so I'm going to have to look in to if that is something I caused but I'm too tired to do that tonight. Link to hosted page that is breaking for me after a few navigates or on load

jordan-git commented 4 years ago

It seems the problem was my Node not being up to date. I was able to develop my site fine up until some point where this started happening. Updating Node fixed that issue. I fixed my other issue also.

eliooses-zondax commented 3 years ago

I have been dealing with this issue from day one of using Gatsby. No matter what starter or theme I use, the same thing always happens to me.

Any solution?

maulerjan commented 3 years ago

I have been dealing with this issue from day one of using Gatsby. No matter what starter or theme I use, the same thing always happens to me.

Any solution?

Exactly the same for me. Would also like some solution for this (although it doesn't seem mission critical at this point as this only happens on my development Windows machine and not in my CI, so my production release cycle is not affected in any way).

OddBlueDog commented 3 years ago

Same issue here, I have been pressing ctrl + c. On Windows 10, gatsby-cli 2.17.0, and node 14.15.3

moonmeister commented 3 years ago

Latest Gatsby(v2.30) updated to ink@v3. I'm curios if anyone could update and test to see if this has resolved the issue.

OddBlueDog commented 3 years ago

Latest Gatsby(v2.30) updated to ink@v3. I'm curios if anyone could update and test to see if this has resolved the issue.

I'll give it a test over the next few days. I have updated all my packages now and done a gatsby clean.

maulerjan commented 3 years ago

I can confirm that I no longer see this issue happening after upgrading to the latest version. Thank you!

mahmoudmiz commented 3 years ago

same here

henrik-m commented 3 years ago

@moonmeister Looked good yesterday after updating to gatsby@2.30.1. But today I've had a change in gatsby-config.js and am experiencing the issue again unfortunately.

gatsby develop stalls on onPostBootstrap/Build manifest and related icons in first build after config-change. Killing the process and re-issuing the command runs successfully to the end. Which is how it's always been for me.

edit: It does not happen after every config change though, so I can't reliably reproduce it.

moonmeister commented 3 years ago

You mind sharing what you changed? and in you experience does it matter what you change in config, or is it anything?

Alex

On 1/7/2021 6:36 AM, henrik-m wrote:

@moonmeister https://github.com/moonmeister Looked good yesterday after updating to gatsby@2.30.1. But today I've had a change in |gatsby-config.js| and am experiencing the issue again unfortunately.

|gatsby develop| stalls on |onPostBootstrap/Build manifest and related icons| in first build after config-change. Killing the process and re-issuing the command runs successfully to the end. Which is how it's always been for me.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gatsbyjs/gatsby/issues/25216#issuecomment-756090987, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAU2W535ZHYQFMD23VXBJUTSYWTFNANCNFSM4OFGMDTA.

henrik-m commented 3 years ago

I added a require to another (dependency-less) JS file containing additional config variables. I used them to change a few options for the plugin gatsby-plugin-google-marketing-platform. I would be suprised if the particular change mattered though.

I undid and redid the changes, did a production build in between, but have not been able to reproduce the issue yet. It seems to have been a "first build of the day" thing so far. So the situation has definitely improved. I was getting this a lot more often in the past.

artdiev commented 3 years ago

I am also getting the issue Running on node 15.5 & Windows 10 20H2 Gatsby 2.30.1 & 2.30.

For me, the issue seems to disappear if I choose a png as a source file instead of an svg

OddBlueDog commented 3 years ago

I think it's better, sometimes you do just have to wait a bit for the re-building to happen around 10s for minor CSS changes.

kimbaudi commented 3 years ago

I've been facing the same issue on Windows (stuck on onPostBootstrap & Build manifest and related icons), but largely ignore it because I just hit Ctrl+C and run it again (which works all the time). I am using an svg instead of a png for the icon. It is not a big deal, but kinda annoying since I have to hit Ctrl+C to get it to work in dev.

gatsby-config.js

    {
      resolve: `gatsby-plugin-manifest`,
      options: {
        ...
        icon: `src/imgs/icons/laptop-color.svg`,
      },
    },
    `gatsby-plugin-offline`, // Note: list this plugin after gatsby-plugin-manifest

output:

$  yarn start
yarn run v1.22.10
$ gatsby clean
info Deleting .cache, public, C:\dev\paulkode.com\node_modules\.cache\babel-loader, C:\dev\paulkode.com\node_modules\.cache\terser-webpack-plugin
info Successfully deleted directories

$ gatsby develop --host=0.0.0.0 --port=4242 --open
success open and validate gatsby-configs - 0.074s
success load plugins - 0.679s
success onPreInit - 0.037s
success initialize cache - 0.008s
success copy gatsby files - 0.132s
success onPreBootstrap - 0.033s
success createSchemaCustomization - 0.003s
success Checking for changed pages - 0.002s
success source and transform nodes - 0.066s
success building schema - 0.216s
info Total nodes: 30, SitePage nodes: 1 (use --verbose for breakdown)
success createPages - 0.004s
success Checking for changed pages - 0.001s
success createPagesStatefully - 0.158s
success update schema - 0.022s
success write out redirect data - 0.002s
⠇ onPostBootstrap
⠇ Build manifest and related icons
fayzanx commented 3 years ago

I am also facing the same issue when trying to run gatsby develop on Windows 10 using node v12.16.3, gatsby-cli v2.19.2 and gatsby v2.32.11

I've tried almost all of the fixes suggested above, but still facing the issue.

Also, in my case the process is stuck at onPreBootstrap.

eightbit commented 3 years ago

Same issue here - develop fails the first time, then runs after ctrl-c. Subscribing to this thread. Happy to help if you need info about my config or versions. Thx.

jacobabiola commented 3 years ago

i am have in the same issue

C:\Users\user\codes\startr-homepage>gatsby develop
success open and validate gatsby-configs - 3.508s
success load plugins - 82.187s
success onPreInit - 0.984s
success initialize cache - 0.705s
success copy gatsby files - 8.100s
success onPreBootstrap - 0.675s
success createSchemaCustomization - 0.081s
success Checking for changed pages - 0.013s
success source and transform nodes - 2.290s
success building schema - 4.693s
info Total nodes: 74, SitePage nodes: 1 (use --verbose for breakdown)
success createPages - 0.024s
success Checking for changed pages - 0.019s
success createPagesStatefully - 1.485s
success update schema - 0.701s
success write out redirect data - 0.016s
⠋ onPostBootstrap
⠏ Build manifest and related icons
MartSurv commented 3 years ago

Hello guys. I used Solus OS (linux) and gatsby worked just fine without any problem. Now I'm using Windows 10 (x64). Everything I type "gatsby develop" the first time after turning on my computer, it stucks right here:

success write out requires - 0.116s
success write out redirect data - 0.016s
⠋ onPostBootstrap
⠋ Build manifest and related icons

And I have to Ctrl+C and then "gatsby develop" again and it works. Always stucks at the first time.

My solution was;

  1. Update the gatsby-cli and nodejs if possible.
  2. Remove the node_modules, .cache, the public folder and the yarn.lock or package-lock.json files.
  3. I believe the sharp or the pngquant libraries need some processing power to compress your images and icons, to free some resources you could kills some apps or processes running on your machine using Task manager on Windows OS, for example Google Chrome or any other apps consuming resources on your CPU and Memory then try to run yarn install and gatsby develop and it did worked for me.

This solution helped me also. I updated gatsby-cli, removed the node_modules, .cache, public folders and the package-lock.json file. After that I ran a clean npm install.

ownchoice commented 3 years ago

I'm having the same problem on Windows 10, but it doesn't always happen. Sometimes it does, sometimes it doesn't. Even deleting .cache, node_modules, public and package-lock.json and updating gatsby-cli doesn't seem to fix it or to make it consistent.

But what does fix it is commenting out this code block of the gatsby-config.js file:

{
  resolve: 'gatsby-plugin-manifest',
  options: {
    name: config.siteTitle,
    short_name: config.siteTitleShort,
    description: config.siteDescription,
    start_url: validatedPathPrefix,
    background_color: config.backgroundColor,
    theme_color: config.themeColor,
    display: 'minimal-ui',
    icon: 'static/favicon.svg'
  }
},
alexjorgef commented 3 years ago

Steps to reproduce

  1. Installed the package gatsby-source-gitlab-api
  2. Added it to my gatsby-config.js file
  3. Run gatsby develop

Result

...

success initialize cache - 0.040s
success copy gatsby files - 0.156s
success Compiling Gatsby Functions - 0.400s
success onPreBootstrap - 0.435s
success createSchemaCustomization - 0.083s
⠇ source and transform nodes

Environment

yarn.lock

...

gatsby-source-gitlab-api@^1.0.5:
  version "1.0.5"
  resolved "https://registry.yarnpkg.com/gatsby-source-gitlab-api/-/gatsby-source-gitlab-api-1.0.5.tgz#0734ab542c235b149740b42e766f34e803afddfb"
  integrity sha512-vVs4SvkGgY2xaJZWsfaxUy33vRcOArhJtdHcei2i8tHTyleRdr8OYr8nVbTG9Yg829uHSFySC5x/VBEfAPNQcg==
  dependencies:
    "@gitbeaker/browser" "^28.0.4"
    "@gitbeaker/cli" "^28.0.4"
    "@gitbeaker/node" "^28.0.4"

...

package.json

...

  "dependencies": {
    "gatsby": "^3.8.0",
    "gatsby-image": "^3.8.0",
    "gatsby-plugin-google-analytics": "^3.8.0",
    "gatsby-plugin-manifest": "^3.8.0",
    "gatsby-plugin-offline": "^4.8.0",
    "gatsby-plugin-react-helmet": "^4.8.0",
    "gatsby-plugin-sharp": "^3.8.0",
    "gatsby-plugin-styled-components": "^4.8.0",
    "gatsby-remark-copy-linked-files": "^4.5.0",
    "gatsby-remark-images": "^5.5.0",
    "gatsby-remark-prismjs": "^5.5.0",
    "gatsby-remark-responsive-iframe": "^4.5.0",
    "gatsby-remark-smartypants": "^4.5.0",
    "gatsby-source-filesystem": "^3.8.0",
    "gatsby-source-github-api": "^1.0.0",
    "gatsby-source-gitlab-api": "^1.0.5",
    "gatsby-transformer-remark": "^4.5.0",
    "gatsby-transformer-sharp": "^3.8.0",
    "node-sass": "^6.0.1",
    "prismjs": "^1.20.0",
    "prop-types": "^15.7.2",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-github-btn": "^1.2.0",
    "react-github-button": "^0.1.11",
    "react-helmet": "^6.1.0",
    "react-icons": "^4.2.0",
    "sharp": "^0.28.3",
    "styled-components": "^5.1.1"
  },
  "devDependencies": {
    "prettier": "2.3.2"
  },
  "resolutions": {
    "graphql": "^15.4.0",
    "graphql-compose": "^9.0.2",
    "webpack": "^5.24.2"
  },

...

What I've tried

References: @28development/gatsby-source-gitlab-api#1, @gatsbyjs/gatsby#17131, @gatsbyjs/gatsby#28632

ownchoice commented 3 years ago

This issue is driving me crazy, two thirds of my attempts to do gatsby build o develop end ups stuck just like this.

⠋ onPostBootstrap
⠋ Build manifest and related icons

Commenting out the SVG icon for the manifest plugin fixes this issue, but I need it for production builds.

Seems to happen on Windows 10 but not on Ubuntu server 🤷

kdoroszewicz commented 3 years ago

For me this workaround from issue #31878 works. I was hoping it was fixed in the latest version of Gatsby, but the problem just moved from production build to development build.

// gatsby-node.js
// TODO: temporary workaround for https://github.com/gatsbyjs/gatsby/issues/31878
exports.onCreateWebpackConfig = ({ actions, plugins, stage, getConfig }) => {
  // override config only during production JS & CSS build
  if (stage === "build-javascript") {
    // get current webpack config
    const config = getConfig();

    const options = {
      minimizerOptions: {
        preset: [
          `default`,
          {
            svgo: {
              full: true,
              plugins: [
                // potentially destructive plugins removed - see https://github.com/gatsbyjs/gatsby/issues/15629
                // use correct config format and remove plugins requiring specific params - see https://github.com/gatsbyjs/gatsby/issues/31619
                `removeUselessDefs`,
                `cleanupAttrs`,
                `cleanupEnableBackground`,
                `cleanupIDs`,
                `cleanupListOfValues`,
                `cleanupNumericValues`,
                `collapseGroups`,
                `convertColors`,
                `convertPathData`,
                `convertStyleToAttrs`,
                `convertTransform`,
                `inlineStyles`,
                `mergePaths`,
                `minifyStyles`,
                `moveElemsAttrsToGroup`,
                `moveGroupAttrsToElems`,
                `prefixIds`,
                `removeAttrs`,
                `removeComments`,
                `removeDesc`,
                // `removeDimensions`,
                `removeDoctype`,
                `removeEditorsNSData`,
                `removeEmptyAttrs`,
                `removeEmptyContainers`,
                `removeEmptyText`,
                `removeHiddenElems`,
                `removeMetadata`,
                `removeNonInheritableGroupAttrs`,
                `removeOffCanvasPaths`,
                `removeRasterImages`,
                `removeScriptElement`,
                `removeStyleElement`,
                `removeTitle`,
                `removeUnknownsAndDefaults`,
                `removeUnusedNS`,
                `removeUselessStrokeAndFill`,
                `removeXMLProcInst`,
                `reusePaths`,
                `sortAttrs`,
              ],
            },
          },
        ],
      },
    };
    // find CSS minimizer
    const minifyCssIndex = config.optimization.minimizer.findIndex(
      (minimizer) => minimizer.constructor.name === "CssMinimizerPlugin"
    );
    // if found, overwrite existing CSS minimizer with the new one
    if (minifyCssIndex > -1) {
      config.optimization.minimizer[minifyCssIndex] =
        plugins.minifyCss(options);
    }
    // replace webpack config with the modified object
    actions.replaceWebpackConfig(config);
  }
};
justinsane98 commented 3 years ago

I was still running into this issue this morning and I simply renamed the svg file and updated the reference in the manifest and it has completely resolved the issue. Why this resolves the issue? No clue... but it does work 100% of the time now when I was previously deploying with less than a 50% success rate. Hopefully this will help folks figure out the underlying issue.