gatsby - Netlify 部署失败

标签 gatsby netlify netlify-cms netlify-cli gatsby-plugin-intl

有谁知道为什么我会收到以下错误:

Verify run directory
10:47:31 PM: ​
10:47:31 PM: ┌─────────────────────────────┐
10:47:31 PM: │        Netlify Build        │
10:47:31 PM: └─────────────────────────────┘
10:47:31 PM: ​
10:47:31 PM: ❯ Version
10:47:31 PM:   @netlify/build 1.0.16
10:47:31 PM: ​
10:47:31 PM: ❯ Flags
10:47:31 PM:   mode: buildbot
10:47:31 PM: ​
10:47:31 PM: ❯ Current directory
10:47:31 PM:   /opt/build/repo
10:47:31 PM: ​
10:47:31 PM: ❯ Config file
10:47:31 PM:   No config file was defined: using default values.
10:47:31 PM: ​
10:47:31 PM: ❯ Context
10:47:31 PM:   production
10:47:31 PM: ​
10:47:31 PM: ┌────────────────────────────────┐
10:47:31 PM: │ 1. Build command from settings │
10:47:31 PM: └────────────────────────────────┘
10:47:31 PM: ​
10:47:31 PM: $ gatsby develop
10:47:34 PM: error UNHANDLED REJECTION Cannot read property 'activities' of undefined
10:47:34 PM: 
10:47:34 PM: 
10:47:34 PM:   TypeError: Cannot read property 'activities' of undefined
10:47:34 PM:   
10:47:34 PM:   - utils.js:20 getGlobalStatus
10:47:34 PM:     [repo]/[gatsby-cli]/lib/reporter/redux/utils.js:20:54
10:47:34 PM:   
10:47:34 PM:   - internal-actions.js:135 Object.startActivity
10:47:34 PM:     [repo]/[gatsby-cli]/lib/reporter/redux/internal-actions.js:135:51
10:47:34 PM:   
10:47:34 PM:   - redux.js:483 Object.startActivity
10:47:34 PM:     [repo]/[redux]/lib/redux.js:483:35
10:47:34 PM:   
10:47:34 PM:   - reporter-timer.js:24 Object.start
10:47:34 PM:     [repo]/[gatsby-cli]/lib/reporter/reporter-timer.js:24:23
10:47:34 PM:   
10:47:34 PM:   - index.js:125 module.exports
10:47:34 PM:     [repo]/[gatsby]/dist/bootstrap/index.js:125:12
10:47:34 PM:   
10:47:34 PM:   - develop.js:407 module.exports
10:47:34 PM:     [repo]/[gatsby]/dist/commands/develop.js:407:36
10:47:34 PM:   
10:47:34 PM:   - next_tick.js:68 process._tickCallback
10:47:34 PM:     internal/process/next_tick.js:68:7
10:47:34 PM:   
10:47:34 PM: 
10:47:34 PM: /opt/build/repo/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
10:47:34 PM:         throw ex;
10:47:34 PM:         ^
10:47:34 PM: TypeError: Cannot read property 'activities' of undefined
10:47:34 PM:     at getGlobalStatus (/opt/build/repo/node_modules/gatsby-cli/lib/reporter/redux/utils.js:20:54)
10:47:34 PM:     at createPendingActivity (/opt/build/repo/node_modules/gatsby-cli/lib/reporter/redux/internal-actions.js:106:51)
10:47:34 PM:     at /opt/build/repo/node_modules/redux/lib/redux.js:483:35
10:47:34 PM:     at prematureEnd (/opt/build/repo/node_modules/gatsby-cli/lib/reporter/catch-exit-signals.js:39:38)
10:47:34 PM:     at Reporter.panic (/opt/build/repo/node_modules/gatsby-cli/lib/reporter/reporter.js:72:42)
10:47:34 PM:     at process.on.reason (/opt/build/repo/node_modules/gatsby-cli/lib/index.js:81:21)
10:47:34 PM:     at process.emit (events.js:203:15)
10:47:34 PM:     at processEmit [as emit] (/opt/build/repo/node_modules/signal-exit/index.js:161:32)
10:47:34 PM:     at emitPromiseRejectionWarnings (internal/process/promises.js:140:18)
10:47:34 PM:     at process._tickCallback (internal/process/next_tick.js:69:34)
10:47:35 PM: ​
10:47:35 PM: ┌─────────────────────────────┐
10:47:35 PM: │   "build.command" failed    │
10:47:35 PM: └─────────────────────────────┘
10:47:35 PM: ​
10:47:35 PM:   Error message
10:47:35 PM:   Command failed with exit code 7: gatsby develop
10:47:35 PM: ​
10:47:35 PM:   Error location
10:47:35 PM:   In Build command from settings:
10:47:35 PM:   gatsby develop
10:47:35 PM: ​
10:47:35 PM:   Resolved config
10:47:35 PM:   build:
10:47:35 PM:     command: gatsby develop
10:47:35 PM:     publish: /opt/build/repo/public

其余设置似乎正常工作,我不确定为什么会收到以下错误。之前的部署有效。该站点也适用于我的本地设置,也许我应该对配置区域进行更新,但据我所知,当前的似乎是正确的。

我的配置:

Build Config

请告诉我如何修复以下问题。谢谢!

最佳答案

根据 this GitHub issue问题来自于你的依赖项中有 gatsby-cli,这不是必需的,在这种情况下实际上是有害的。

您应该使用以下命令从项目中删除 gatsby-cli 依赖项:

npm r gatsby-cli

如果这不是解决方案,那么也许您有 this issue并且只需要修改你的 gatsby 版本(它应该在 2.20.29 中修复):

npm up gatsby

如果这不更新 Gatsby,则此依赖项的 semver 字符串可能不允许更新。然后,您可以尝试使用 npm i gatsby@latest 安装最新版本,但您必须注意任何可能的破坏性更改。

关于gatsby - Netlify 部署失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62375916/

相关文章:

hugo - 从 Netlify CMS 添加到 Hugo 站点变量

javascript - Gatsby gatsby-remark-relative-images 不会将 yaml 绝对图像路径转换为相对路径

reactjs - 在 Gatsby、GraphQL 和 Sanity 中使用 _raw 和正常数据进行推理

reactjs - 无法查询类型 "x"上的字段 "y"

javascript - Gatsby :在 Facebook 上分享 -> 图片太小

php - 如何在netlify上运行php文件?

webpack - 使用 PostCSS 8 的 Gatsby - 尝试导入错误 : 'component.module.css' does not contain a default export (imported as 'styles' )

yaml - Netlify CMS - 将数据保存到项目根目录(例如 `__dirname` )

reactjs - 忽略错误 className did not match Server and Client in Gatsby

graphql - 如何通过 GraphQL 从 json 文件中获取数据?