You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// gatsby-node.jsconst{ createFilePath }=require(`gatsby-source-filesystem`);constpath=require(`path`);exports.onCreateNode=({ node, getNode, boundActionCreators })=>{if(node.internal.type===`MarkdownRemark`){const{ createNodeField }=boundActionCreators;constslug=createFilePath({ node, getNode,basePath: `pages`});createNodeField({
node,name: `slug`,value: slug,});}};exports.createPages=({ graphql, boundActionCreators })=>{const{ createPage }=boundActionCreators;returnnewPromise((resolve,reject)=>{graphql(` { allMarkdownRemark { edges { node { fields { slug } } } } } `).then(result=>{result.data.allMarkdownRemark.edges.map(({ node })=>{if(node.fields.slug!=="/home/"){createPage({path: node.fields.slug,component: path.resolve(`./src/templates/page.js`),context: {// Data passed to context is available in page queries as GraphQL variables.slug: node.fields.slug,},});}});resolve();});});};
// gatsby-browser.jsimport{cssMediaQueries}from"./src/utils/mediaqueries.js";letjsMediaQueries={};// not ideal, find some better way to do this.exports.onRouteUpdate=function(){if(window){// console.log(window);for(letbreakptincssMediaQueries){jsMediaQueries[breakpt]=window.matchMedia(cssMediaQueries[breakpt].match(/and(.*)/)[1],).matches;}}};export{jsMediaQueries};
I'm using gatsby on a small project. The development server works fine without any issues, however gatsby build gives the following error
Full stack:
uccess Building CSS — 7.027 s
success Building production JavaScript bundles — 23.078 s
⠠ Building static HTML for pages----------- {} -----------
render landingpage {}
error Building static HTML for pages failed
See our docs page on debugging HTML builds for help https://goo.gl/yL9lND
20 |
21 | // NOTE: I could have used react helmet inside layout as well
> 22 | if (this.props.location.pathname === "/") {
| ^
23 | css.insert(`
24 | ${bwToColorStr}
25 | .gatsby-resp-image-image {
WebpackError: Cannot read property 'pathname' of undefined
- index.js:22 LandingPage.render
src/pages/index.js:22:29
- ReactCompositeComponent.js:798 ReactCompositeComponentWrapper._renderValid atedComponentWithoutOwnerOrContext
~/react-dom/lib/ReactCompositeComponent.js:798:1
- ReactCompositeComponent.js:821 ReactCompositeComponentWrapper._renderValid atedComponent
~/react-dom/lib/ReactCompositeComponent.js:821:1
- ReactCompositeComponent.js:361 ReactCompositeComponentWrapper.performIniti alMount
~/react-dom/lib/ReactCompositeComponent.js:361:1
- ReactCompositeComponent.js:257 ReactCompositeComponentWrapper.mountCompone nt
~/react-dom/lib/ReactCompositeComponent.js:257:1
- ReactReconciler.js:45 Object.mountComponent
~/react-dom/lib/ReactReconciler.js:45:1
- ReactMultiChild.js:236 ReactDOMComponent.mountChildren
~/react-dom/lib/ReactMultiChild.js:236:1
- ReactDOMComponent.js:659 ReactDOMComponent._createContentMarkup
~/react-dom/lib/ReactDOMComponent.js:659:1
- ReactDOMComponent.js:526 ReactDOMComponent.mountComponent
~/react-dom/lib/ReactDOMComponent.js:526:1
- ReactReconciler.js:45 Object.mountComponent
~/react-dom/lib/ReactReconciler.js:45:1
Gatsby Version:
1.9.19
Node Version:
8.3.0
Mac OS Version:
System Version: macOS 10.12.6 (16G29) Kernel Version: Darwin 16.7.0
I'm using gatsby on a small project. The development server works fine without any issues, however
gatsby build
gives the following errorFull stack:
Repo and Branch to reproduce: https://github.com/motherteresa-welfaretrust/website/tree/bug/build-failure
The text was updated successfully, but these errors were encountered: