I am cloning the repo, running npm install and copying the public folder from a previous pipeline step.
If run gatsby serve, it returns an exit code 1.
If I run gatsby build again, it works.
I am running gatsby serve in my CI/CD pipeline. The "error" that is coming back is very confusing.

Any ideas what the problem is?
gatsby info --clipboard
System:
OS: Linux 4.19 Debian GNU/Linux 9 (stretch) 9 (stretch)
CPU: (1) x64 Intel(R) Xeon(R) CPU @ 2.30GHz
Shell: 4.4.12 - /bin/bash
Binaries:
Node: 10.16.0 - /usr/local/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Languages:
Python: 2.7.13 - /usr/bin/python
npmPackages:
gatsby: ^2.13.31 => 2.13.31
gatsby-image: ^2.2.6 => 2.2.6
gatsby-plugin-manifest: ^2.2.3 => 2.2.3
gatsby-plugin-offline: ^2.2.4 => 2.2.4
gatsby-plugin-react-helmet: ^3.1.2 => 3.1.2
gatsby-plugin-sharp: ^2.2.8 => 2.2.8
gatsby-source-filesystem: ^2.1.5 => 2.1.5
gatsby-transformer-sharp: ^2.2.4 => 2.2.4
npmGlobalPackages:
gatsby-cli: 2.7.20
This looks very strange. It seems like the gatsby serve --verbose command is being run multiple times for some reason.
Are you able to replicate this error when running locally? And are you able to share the project that causes this error?
Thank you for your reply @m-allanson . I have managed to replicate this locally as well.
It seems that gatsby serve gets confused if the .cache folder is missing.
Thanks for the investigation @vdespa! I've opened a PR #16246 that should fix this.
As a workaround you can copy .cache/match-paths.json from the previous pipeline step, and the serve command should run as expected.
I just stopped by to say that 馃ゴ is a great emoji and we can imagine your sentiment 馃槀
Great, thanks for the quick fix @m-allanson
This still happens....
Most helpful comment
I just stopped by to say that 馃ゴ is a great emoji and we can imagine your sentiment 馃槀