我在构建盖茨比时遇到问题。 我尝试通过qraphql向应用程序添加一些页面,并且在开发过程中运行良好,但是当我尝试使用gatsby构建时,它崩溃了。
在许多文章中,我看到在gatsby-node.js中使用“ .default”来require()。还删除或更改了应用程序中的任何“窗口”。
Building static HTML failed for path "/exchange/1/"
See our docs page for more info on this error: https://gatsby.dev/debug-html
Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified d ev environment for full errors and additional helpful warnings.
- react-dom-server.node.production.min.js:47 a.render
[kanga-kantorykanga-www]/[react-dom]/cjs/react-dom-server.node.production.min.js:47:349
- react-dom-server.node.production.min.js:44 a.read
[kanga-kantorykanga-www]/[react-dom]/cjs/react-dom-server.node.production.min.js:44:161
- react-dom-server.node.production.min.js:55 renderToString
[kanga-kantorykanga-www]/[react-dom]/cjs/react-dom-server.node.production.min.js:55:83
- render-page.js:552 Module../.cache/static-entry.js.__webpack_exports__.default
/Users/hubertworwa/Kanga/kanga-kantorykanga-www/public/render-page.js:552:28
- render-html.js:35 Promise
[kanga-kantorykanga-www]/[gatsby]/dist/utils/worker/render-html.js:35:36
- debuggability.js:313 Promise._execute
[kanga-kantorykanga-www]/[bluebird]/js/release/debuggability.js:313:9
- promise.js:488 Promise._resolveFromExecutor
[kanga-kantorykanga-www]/[bluebird]/js/release/promise.js:488:18
- promise.js:79 new Promise
[kanga-kantorykanga-www]/[bluebird]/js/release/promise.js:79:10
- render-html.js:31 Promise.map.path
[kanga-kantorykanga-www]/[gatsby]/dist/utils/worker/render-html.js:31:37
- util.js:16 tryCatcher
[kanga-kantorykanga-www]/[bluebird]/js/release/util.js:16:23
- map.js:61 MappingPromiseArray._promiseFulfilled
[kanga-kantorykanga-www]/[bluebird]/js/release/map.js:61:38
- promise_array.js:114 MappingPromiseArray.PromiseArray._iterate
[kanga-kantorykanga-www]/[bluebird]/js/release/promise_array.js:114:31
- promise_array.js:78 MappingPromiseArray.init
[kanga-kantorykanga-www]/[bluebird]/js/release/promise_array.js:78:10
- map.js:30 MappingPromiseArray._asyncInit
[kanga-kantorykanga-www]/[bluebird]/js/release/map.js:30:10
- async.js:142 _drainQueueStep
[kanga-kantorykanga-www]/[bluebird]/js/release/async.js:142:12
- async.js:131 _drainQueue
[kanga-kantorykanga-www]/[bluebird]/js/release/async.js:131:9
exports.createPages = ({ actions }) => {
const { createPage } = actions
localizations.forEach(location => {
location.locations.forEach(point => {
createPage({
path: `/exchange/${point.id}/`,
component: require.resolve(`./src/components/templates/ExchangeSite.js`),
context: { point: point },
})
})
})
}
const localizations = [...]
gatsby-node.js
预期结果: gatsby构建成功