Gatsby develop leaves .cache/json empty from version 2.24.12
See original GitHub issueDescription
I cannot use the gatsby develop
command because it leaves an empty .cache/json
folder thus the dev server cannot serve the site.
Unforunately the codebase is private but I was able identify on which gatsby version the issue occured. Gatsby 2.24.8 and 2.24.10 => OK develop works normally Gatsby 2.24.9 and 2.24.11 => develop works but output non blocking errors at the end of the script :
Error loading a result for the page query in "/dev-404-page". Query was not run and no cached result was found.
Error loading a result for the page query in "/404.html". Query was not run and no cached result was found.
Error loading a result for the page query in "/". Query was not run and no cached result was found.
From Gatsby 2.24.12 to current version 2.24.34 (I didn’t test every version in between) =>.cache/json stays empty during develop script. This is the last output before crash :
success Building development bundle - 55.715s
ERROR
ENOENT: no such file or directory, open '/Users/path/to/project/.cache/json/_...random..._page.json'
Steps to reproduce
Run gatsby develop
Expected result
The develop script run smoothly and and development server is launched at the end of the process
Actual result
The develop script runs without apparent errors but then the dev server crashes because .cache/json is empty
Environment
System:
OS: macOS 10.15.6
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 14.4.0 - ~/.nvm/versions/node/v14.4.0/bin/node
Yarn: 1.22.4 - ~/.yarn/bin/yarn
npm: 6.14.5 - ~/.nvm/versions/node/v14.4.0/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Chrome: 84.0.4147.105
Firefox: 79.0
Safari: 13.1.2
npmPackages:
gatsby: ^2.24.34 => 2.24.34
gatsby-background-image: ^1.1.1 => 1.1.1
gatsby-image: ^2.4.14 => 2.4.14
gatsby-plugin-eslint: ^2.0.8 => 2.0.8
gatsby-plugin-google-tagmanager: ^2.3.11 => 2.3.11
gatsby-plugin-manifest: ^2.4.22 => 2.4.22
gatsby-plugin-material-ui: ^2.1.10 => 2.1.10
gatsby-plugin-node-reload: ^1.1.0 => 1.1.0
gatsby-plugin-offline: ^3.2.22 => 3.2.22
gatsby-plugin-react-helmet: ^3.3.10 => 3.3.10
gatsby-plugin-react-leaflet: ^2.0.13 => 2.0.13
gatsby-plugin-remote-images: ^2.2.0 => 2.2.0
gatsby-plugin-s3: ^0.3.3 => 0.3.4
gatsby-plugin-sass: ^2.3.12 => 2.3.12
gatsby-plugin-sharp: ^2.6.25 => 2.6.25
gatsby-plugin-typegen: ^2.2.1 => 2.2.1
gatsby-plugin-typescript: ^2.4.15 => 2.4.17
gatsby-plugin-typescript-checker: ^1.1.1 => 1.1.1
gatsby-source-filesystem: ^2.3.24 => 2.3.24
gatsby-source-graphql: ^2.7.0 => 2.7.0
gatsby-transformer-sharp: ^2.5.12 => 2.5.12
npmGlobalPackages:
gatsby-cli: 2.12.77
Dependencies
"dependencies": {
"@date-io/date-fns": "^1.3.13",
"@material-ui/core": "^4.10.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.56",
"@material-ui/pickers": "^3.2.10",
"@react-hook/throttle": "^2.2.0",
"axios": "^0.19.2",
"babel-preset-react-app": "^9.1.1",
"classnames": "^2.2.6",
"date-fns": "^2.15.0",
"date-fns-timezone": "^0.1.4",
"deepmerge": "^4.2.2",
"dompurify": "^2.0.11",
"elasticsearch-browser": "^16.7.1",
"gatsby": "^2.24.34",
"gatsby-background-image": "^1.1.1",
"gatsby-image": "^2.4.14",
"gatsby-plugin-google-tagmanager": "^2.3.11",
"gatsby-plugin-manifest": "^2.4.22",
"gatsby-plugin-material-ui": "^2.1.10",
"gatsby-plugin-node-reload": "^1.1.0",
"gatsby-plugin-offline": "^3.2.22",
"gatsby-plugin-react-helmet": "^3.3.10",
"gatsby-plugin-react-leaflet": "^2.0.13",
"gatsby-plugin-remote-images": "^2.2.0",
"gatsby-plugin-s3": "^0.3.3",
"gatsby-plugin-sass": "^2.3.12",
"gatsby-plugin-sharp": "^2.6.25",
"gatsby-plugin-typegen": "^2.2.1",
"gatsby-plugin-typescript": "^2.4.15",
"gatsby-plugin-typescript-checker": "^1.1.1",
"gatsby-source-filesystem": "^2.3.24",
"gatsby-source-graphql": "^2.7.0",
"gatsby-transformer-sharp": "^2.5.12",
"leaflet": "^1.6.0",
"node-sass": "^4.14.1",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-helmet": "^6.1.0",
"react-intl": "^5.4.6",
"react-leaflet": "^2.7.0",
"react-player": "^2.5.0",
"slugify": "^1.4.5",
"yup": "^0.29.3"
},
"devDependencies": {
"@formatjs/cli": "^2.3.1",
"@octokit/core": "^3.1.2",
"@octokit/plugin-retry": "^3.0.3",
"@octokit/rest": "^18.0.1",
"@storybook/addon-actions": "^5.3.19",
"@storybook/addon-info": "^5.3.19",
"@storybook/addon-knobs": "^5.3.19",
"@storybook/addon-links": "^5.3.19",
"@storybook/addon-viewport": "^5.3.19",
"@storybook/addons": "^5.3.19",
"@storybook/react": "^5.3.19",
"@types/classnames": "^2.2.10",
"@types/dompurify": "^2.0.3",
"@types/geojson": "^7946.0.7",
"@types/jest": "^26.0.9",
"@types/leaflet": "^1.5.16",
"@types/react": "^16.9.44",
"@types/react-dom": "^16.9.7",
"@types/react-helmet": "^6.1.0",
"@types/react-leaflet": "^2.5.1",
"@types/yup": "^0.29.4",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"babel-loader": "^8.0.6",
"env-cmd": "^10.1.0",
"eslint": "^7.6.0",
"eslint-config-airbnb-typescript": "^9.0.0",
"eslint-config-prettier": "^6.11.0",
"eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.5",
"eslint-plugin-react-hooks": "^4.0.8",
"gatsby-plugin-eslint": "^2.0.8",
"husky": "^4.2.3",
"lint-staged": "^10.2.11",
"minimist": "^1.2.3",
"prettier": "^2.0.5",
"shelljs": "^0.8.4",
"typescript": "^3.9.7"
},
Gatsby-Config
const activeEnv = process.env.GATSBY_ACTIVE_ENV || process.env.NODE_ENV || 'development';
require('dotenv').config({
path: `.env.${activeEnv}`,
});
module.exports = {
pathPrefix: '', // CircleCi Artifacts prefix
assetPrefix: process.env.ASSET_PREFIX_URL,
siteMetadata: {
title: 'title',
description: 'description',
author: '@autho',
},
plugins: [
{
resolve: 'gatsby-plugin-google-tagmanager',
options: {
id: process.env.GATSBY_GTM_ID,
includeInDevelopment: true,
},
},
'gatsby-plugin-typescript',
'gatsby-plugin-typescript-checker',
'gatsby-plugin-node-reload',
{
resolve: 'gatsby-plugin-typegen',
options: {
emitSchema: {
'src/__generated__/gatsby-introspection.json': true,
'src/__generated__/gatsby-schema.graphql': true,
},
emitPluginDocuments: {
'src/__generated__/gatsby-plugin-documents.graphql': true,
},
},
},
{
resolve: 'gatsby-source-graphql',
options: {
// Arbitrary name for the remote schema Query type
typeName: 'GATEWAY',
// Field under which the remote schema will be accessible. You'll use this in your Gatsby query
fieldName: 'gateway',
// Url to query from
url: process.env.GATSBY_GRAPHQL_API,
},
},
{
resolve: 'gatsby-plugin-react-leaflet',
options: {
linkStyles: true, // (default: true) Enable/disable loading stylesheets via CDN
},
},
{
resolve: 'gatsby-plugin-eslint',
options: {
test: /\.js$|\.jsx$|\.ts$|\.tsx$/,
exclude: /(node_modules|.cache|public)/,
stages: ['develop'],
options: {
emitWarning: true,
failOnError: true,
},
},
},
'gatsby-plugin-sass',
'gatsby-plugin-react-helmet',
'gatsby-plugin-material-ui-theme-provider', // Custom Plugin
{
resolve: 'gatsby-plugin-material-ui',
options: {
stylesProvider: {
injectFirst: true,
},
},
},
{
resolve: 'gatsby-source-s3-asset',
options: {
accessKeyId: process.env.GATSBY_AWS_ACCESS_KEY,
secretAccessKey: process.env.GATSBY_AWS_SECRET_ACCESS_KEY,
region: process.env.GATSBY_AWS_REGION,
bucketName: process.env.GATSBY_ASSETS_BUCKET_NAME,
publicDomain: process.env.GATSBY_ASSETS_BUCKET_NAME,
protocol: 'https',
prefix: 'common',
nodeType: 'Assets',
},
},
{
resolve: 'gatsby-plugin-s3',
options: {
bucketName: 'staging.domain.com',
protocol: 'https',
hostname: 'staging.domain.fr',
},
},
{
resolve: 'gatsby-plugin-remote-images',
options: {
nodeType: 'Assets',
imagePath: 'url',
prepareUrl: (url) => encodeURI(url),
},
},
'gatsby-transformer-sharp',
'gatsby-plugin-sharp',
{
resolve: 'gatsby-plugin-manifest',
options: {
name: 'name',
short_name: 'short_name',
start_url: '/',
background_color: '#252733',
theme_color: '#29c5a9',
display: 'minimal-ui',
icon: 'src/images/icon.png', // This path is relative to the root of the site.
},
},
],
};
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:10 (7 by maintainers)
Top GitHub Comments
So the issue is that
gatsby-plugin-typegen
writes files into the src director during query running.While we have calculated which queries to run after staticQueries we get back into extractingQuery state and calculateDirtyQueries will not give us the correct information anymore so it looks like we have 0 pageQueries to run
Gatsby develop log
Successfully published: