在构建静态HTML的过程中出现错误:
8 | else
9 | root["lib"] = factory(root["@reach/router"], root["core-
js/modules/es6.array.sort"], root["fs"], root["lodash"], root["path"],
root["react"], root["react-dom/server"], root["react-helmet"]);
> 10 | })(this, function(__WEBPACK_EXTERNAL_MODULE__reach_router__,
__WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_array_sort__,
__WEBPACK_EXTERNAL_MODULE_fs__, __WEBPACK_EXTERNAL_MODULE_lodash__,
__WEBPACK_EXTERNAL_MODULE_path__, __WEBPACK_EXTERNAL_MODULE_react__,
__WEBPACK_EXTERNAL_MODULE_react_dom_server__,
__WEBPACK_EXTERNAL_MODULE_react_helmet__) {
| ^
11 | return
WebpackError: Invariant Violation: Minified React error #152; visit
https://reactjs.org/docs/error-decoder.html?
invariant=152&args[]=Component for the f ull message or use the non-
minified dev environment for full errors and additional helpful
warnings.
尽管该消息有点神秘。 (没有说它在哪个组件中失败),看来问题应该首先存在于react-helmet中。
试图更新react-helmet和react-plugin-helmet的版本。没用删除了所有的React头盔痕迹,该错误消失了,但是之后出现了类似lodash的错误(Invariant Violation:Minified React error#152)。 Lodash仅在package-lock.json中引用。尝试在package.json lodash和gatsby-plugin lodash中安装未成功。
按预期,在开发模式下,一切正常。
我之前检查了每个组件返回。我走得更远,放弃了隐式的回报,并使React中的所有回报都是明确的。
仍然没有工作
构建问题不会随着降级节点或更新gatsby而消失并对最新版本做出反应。
这是仓库
https://github.com/pedrotavaresgoncalves/gatsby-debug
环境:
System:
OS: macOS 10.14
CPU: x64 Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: v10.13.0 - /usr/local/bin/node
npm: 6.4.1 - /usr/local/bin/npm
Browsers:
Chrome: 70.0.3538.77
Firefox: 60.0.2
Safari: 12.0
npmPackages:
gatsby: 2.0.19 => 2.0.19
gatsby-image: ^2.0.19 => 2.0.19
gatsby-plugin-lodash: ^3.0.2 => 3.0.2
gatsby-plugin-manifest: 2.0.2 => 2.0.2
gatsby-plugin-offline: 2.0.5 => 2.0.5
gatsby-plugin-react-helmet: ^3.0.1 => 3.0.1
gatsby-plugin-sass: 2.0.1 => 2.0.1
gatsby-plugin-sharp: 2.0.6 => 2.0.6
gatsby-plugin-typography: ^2.2.0 => 2.2.0
gatsby-source-filesystem: 2.0.1 => 2.0.1
gatsby-transformer-json: 2.1.2 => 2.1.2
gatsby-transformer-remark: 2.1.3 => 2.1.3
gatsby-transformer-sharp: 2.1.3 => 2.1.3
npmGlobalPackages:
gatsby-cli: 2.4.4