After finished the tutorial(wich it was working with gatsby develop) i ran gatsby build and error.
gatsby build on tutorial end
The build should working with gatsby serve but the page was blank
I got this message below and the build never finish
success Building production JavaScript and CSS bundles — 4.730 s
⠂ Building static HTML for pageserror ../public/74/path---pandas-and-bananas-c-27-086-6z2Obr7WeHZs1zz24wrYOTNgc { Error: ENOENT: no such file or directory, open 'C:\desenvolvimento\projetos\csd\gatsby-tutorial\public\static\d\74\path---pandas-and-bananas-c-27-086-6z2Obr7WeHZs1zz24wrYOTNgc.json'
at Object.fs.openSync (fs.js:667:18)
at Object.fs.readFileSync (fs.js:572:33)
at Module../.cache/static-entry.js.__webpack_exports__.default.React.Component [as default] (C:\desenvolvimento\projetos\csd\gatsby-tutorial\public\render-page.js:575:38)
at Promise (C:\desenvolvimento\projetos\csd\gatsby-tutorial\node_modules\gatsby\dist\utils\worker.js:35:36)
at Promise._execute (C:\desenvolvimento\projetos\csd\gatsby-tutorial\node_modules\bluebird\js\release\debuggability.js:303:9)
at Promise._resolveFromExecutor (C:\desenvolvimento\projetos\csd\gatsby-tutorial\node_modules\bluebird\js\release\promise.js:483:18)
at new Promise (C:\desenvolvimento\projetos\csd\gatsby-tutorial\node_modules\bluebird\js\release\promise.js:79:10)
at Promise.map.path (C:\desenvolvimento\projetos\csd\gatsby-tutorial\node_modules\gatsby\dist\utils\worker.js:31:37)
at tryCatcher (C:\desenvolvimento\projetos\csd\gatsby-tutorial\node_modules\bluebird\js\release\util.js:16:23)
at MappingPromiseArray._promiseFulfilled (C:\desenvolvimento\projetos\csd\gatsby-tutorial\node_modules\bluebird\js\release\map.js:61:38)
at MappingPromiseArray.PromiseArray._iterate (C:\desenvolvimento\projetos\csd\gatsby-tutorial\node_modules\bluebird\js\release\promise_array.js:114:31)
at MappingPromiseArray.init (C:\desenvolvimento\projetos\csd\gatsby-tutorial\node_modules\bluebird\js\release\promise_array.js:78:10)
at MappingPromiseArray._asyncInit (C:\desenvolvimento\projetos\csd\gatsby-tutorial\node_modules\bluebird\js\release\map.js:30:10)
at Async._drainQueue (C:\desenvolvimento\projetos\csd\gatsby-tutorial\node_modules\bluebird\js\release\async.js:138:12)
at Async._drainQueues (C:\desenvolvimento\projetos\csd\gatsby-tutorial\node_modules\bluebird\js\release\async.js:143:10)
at Immediate.Async.drainQueues [as _onImmediate] (C:\desenvolvimento\projetos\csd\gatsby-tutorial\node_modules\bluebird\js\release\async.js:17:14)
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\\desenvolvimento\\projetos\\csd\\gatsby-tutorial\\public\\static\\d\\74\\path---pandas-and-bananas-c-27-086-6z2Obr7WeHZs1zz24wrYOTNgc.json' }
System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i7-3612QM CPU @ 2.10GHz
Binaries:
Yarn: 1.3.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 5.6.0 - C:\Program Filesnodejsnpm.CMD
Browsers:
Edge: 42.17134.1.0
npmPackages:
gatsby: next => 2.0.0-beta.100
gatsby-plugin-emotion: next => 2.0.0-beta.3
gatsby-plugin-typography: next => 2.2.0-beta.3
gatsby-source-filesystem: next => 2.0.1-beta.10
gatsby-transformer-remark: next => 2.1.1-beta.6
gatsby-config.js:
module.exports = {
siteMetadata: {
title: `Pandas eating lots`
},
plugins: [
{
resolve: `gatsby-source-filesystem`,
options: {
name: `src`,
path: `${__dirname}/src/`
}
},
`gatsby-transformer-remark`,
`gatsby-plugin-emotion`,
{
resolve: `gatsby-plugin-typography`,
options: {
pathToConfigModule: `src/utils/typography`
}
}
]
};
package.json:
{
"name": "gatsby-starter-hello-world",
"description": "Gatsby hello world starter",
"license": "MIT",
"scripts": {
"develop": "gatsby develop",
"build": "gatsby build",
"serve": "gatsby serve"
},
"dependencies": {
"emotion": "next",
"emotion-server": "next",
"gatsby": "next",
"gatsby-plugin-emotion": "next",
"gatsby-plugin-typography": "next",
"gatsby-source-filesystem": "next",
"gatsby-transformer-remark": "next",
"react": "^16.3.2",
"react-dom": "^16.3.2",
"react-emotion": "^9.2.6",
"react-typography": "^0.16.13",
"typography": "^0.16.17",
"typography-theme-kirkham": "^0.16.3"
}
}
gatsby-node.js:
const path = require(`path`);
const { createFilePath } = require(`gatsby-source-filesystem`);
exports.onCreateNode = ({ node, getNode, actions }) => {
const { createNodeField } = actions;
if (node.internal.type === `MarkdownRemark`) {
const slug = createFilePath({ node, getNode, basePath: `pages` });
createNodeField({
node,
name: `slug`,
value: slug
});
}
};
exports.createPages = ({ graphql, actions }) => {
const { createPage } = actions;
return new Promise((resolve, reject) => {
graphql(`
{
allMarkdownRemark {
edges {
node {
fields {
slug
}
}
}
}
}
`).then(result => {
result.data.allMarkdownRemark.edges.forEach(({ node }) => {
createPage({
path: node.fields.slug,
component: path.resolve(`./src/templates/blog-post.js`),
context: {
// Data passed to context is available
// in page queries as GraphQL variables.
slug: node.fields.slug
}
});
});
resolve();
});
});
};
gatsby-browser.js
: N/A
gatsby-ssr.js
: N/A
Really sorry. I've deleted the .cache folder and worked.
Thanks for clearing this up. If you experience another problem, please create another issue here.. 👍
@Chuloo I've experienced the same error just now, but not based on any tutorial. I had deleted the public
folder manually before, because I saw some old files from previous builds in there. But I hadn't deleted the .cache
folder. Deleting the .cache
folder worked as well.
That brings up some questions:
gatsby build
deleting the public folder before building?public
folder ever? When?Same error too!
I could be great if we can build without deleting .cache
. But thank you to have shared this :)
I'm getting Error: ENOENT: no such file or directory, stat '/x/x/git/gatsby-site/public/404.html'
after running gatsby clean
and npm run serve
. Not sure if this is related?
@andrecalvo I think you run npm run serve
or gatsby serve
before you built your project, that's why you are facing this kind of problem.
To solve this you need to build your project running npm run build
or gatsby build
and then you can serve it locally.
As you can read from the Gatsby CLI Helper, the command gatsby serve
"Serve previously built Gatsby site."
Most helpful comment
@Chuloo I've experienced the same error just now, but not based on any tutorial. I had deleted the
public
folder manually before, because I saw some old files from previous builds in there. But I hadn't deleted the.cache
folder. Deleting the.cache
folder worked as well.That brings up some questions:
gatsby build
deleting the public folder before building?public
folder ever? When?