我只是一个编程新手,刚刚尝试GatsbyJs几个月。我运行命令";gatsby build";,这就是出现的错误,它在";盖茨比发展";。
1:24:14 AM: failed Building static HTML for pages - 12.853s
1:24:14 AM: error Building static HTML failed for path "/products/"
1:24:14 AM:
1:24:14 AM: 101 |
1:24:14 AM: 102 | var _useReduxContext = useReduxContext(),
1:24:14 AM: > 103 | store = _useReduxContext.store,
1:24:14 AM: | ^
1:24:14 AM: 104 | contextSub = _useReduxContext.subscription;
1:24:14 AM: 105 |
1:24:14 AM: 106 | var selectedState = useSelectorWithStoreAndSubscription(selector, equalityFn, store, contextSub);
1:24:14 AM:
1:24:14 AM: WebpackError: TypeError: Cannot read property 'store' of null
1:24:14 AM:
1:24:14 AM: - useSelector.js:103
1:24:14 AM: node_modules/react-redux/es/hooks/useSelector.js:103:1
1:24:14 AM:
1:24:14 AM: - index.js:12
1:24:14 AM: src/components/ProductListing/index.js:12:37
1:24:14 AM:
1:24:14 AM:
1:24:14 AM: not finished Generating image thumbnails - 85.375s
1:24:14 AM:
1:24:14 AM: ────────────────────────────────────────────────────────────────
1:24:14 AM: "build.command" failed
非常缺乏详细信息和配置(gatsby-ssr.js
、gatsby-browser.js
等(。然而,我认为你的问题与这个GitHub线程非常相似。因此:
-
如果您正在使用
gatsby-ssr.js
API(特别是replaceRenderer
(。尝试更改:exports.replaceRenderer
收件人:
export const replaceRenderer
-
删除代码中的
connect
导入(来自Redux(。如果不使用,应避免:import { connect } from 'react-redux'