Netlify 构建在多个 Gatsby 站点上失败



我所有的Netlify解决方案似乎都存在构建失败的问题。

错误日志:

站点 1,

6:54:30 AM: info deleted directory at /opt/build/repo/src/data
6:54:30 AM: /opt/build/repo/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
6:54:30 AM:         throw ex;
6:54:30 AM:         ^
6:54:30 AM: TypeError: Cannot read property 'internal' of undefined
6:54:30 AM:     at emitter.on.action (/opt/build/repo/node_modules/gatsby/dist/bootstrap/page-hot-reloader.js:56:24)
6:54:30 AM:     at /opt/build/repo/node_modules/mitt/dist/mitt.js:1:206
6:54:30 AM:     at Array.map (<anonymous>)
6:54:30 AM:     at Object.emit (/opt/build/repo/node_modules/mitt/dist/mitt.js:1:190)
6:54:30 AM:     at store.subscribe (/opt/build/repo/node_modules/gatsby/dist/redux/index.js:92:11)
6:54:30 AM:     at dispatch (/opt/build/repo/node_modules/redux/lib/redux.js:228:7)
6:54:30 AM:     at action (/opt/build/repo/node_modules/gatsby/dist/redux/index.js:64:88)
6:54:30 AM:     at /opt/build/repo/node_modules/redux-thunk/lib/index.js:14:16
6:54:30 AM:     at Object.deleteNode (/opt/build/repo/node_modules/redux/lib/redux.js:483:12)
6:54:30 AM:     at emitter.on.action (/opt/build/repo/node_modules/gatsby/dist/internal-plugins/internal-data-bridge/gatsby-node.js:211:23)
6:54:30 AM:     at /opt/build/repo/node_modules/mitt/dist/mitt.js:1:206
6:54:30 AM:     at Array.map (<anonymous>)
6:54:30 AM:     at Object.emit (/opt/build/repo/node_modules/mitt/dist/mitt.js:1:190)
6:54:30 AM:     at store.subscribe (/opt/build/repo/node_modules/gatsby/dist/redux/index.js:92:11)
6:54:30 AM:     at dispatch (/opt/build/repo/node_modules/redux/lib/redux.js:228:7)
6:54:30 AM:     at action (/opt/build/repo/node_modules/gatsby/dist/redux/index.js:64:88)
6:54:31 AM: ​
6:54:31 AM: ┌─────────────────────────────┐
6:54:31 AM: │   "build.command" failed    │
6:54:31 AM: └─────────────────────────────┘
6:54:31 AM: ​
6:54:31 AM:   Error message
6:54:31 AM:   Command failed with exit code 7: gatsby develop
6:54:31 AM: ​
6:54:31 AM:   Error location
6:54:31 AM:   In Build command from settings:
6:54:31 AM:   gatsby develop
6:54:31 AM: ​
6:54:31 AM:   Resolved config
6:54:31 AM:   build:
6:54:31 AM:     command: gatsby develop
6:54:31 AM:     publish: /opt/build/repo/public
6:54:31 AM: Execution timed out after 15m0s
6:54:31 AM: Error running command: Command did not finish within the time limit
6:54:31 AM: Failing build: Failed to build site
6:55:01 AM: Failed to inform the API about a failed build, please retry the build or contact support
6:55:01 AM: Finished processing build request in 30m28.925069189s

站点 2,

6:01:07 PM: Installing missing commands
6:01:07 PM: Verify run directory
6:01:09 PM: ​
6:01:09 PM: ┌─────────────────────────────┐
6:01:09 PM: │        Netlify Build        │
6:01:09 PM: └─────────────────────────────┘
6:01:09 PM: ​
6:01:09 PM: ❯ Version
6:01:09 PM:   @netlify/build 1.0.16
6:01:09 PM: ​
6:01:09 PM: ❯ Flags
6:01:09 PM:   mode: buildbot
6:01:09 PM: ​
6:01:09 PM: ❯ Current directory
6:01:09 PM:   /opt/build/repo
6:01:09 PM: ​
6:01:09 PM: ❯ Config file
6:01:09 PM:   No config file was defined: using default values.
6:01:09 PM: ​
6:01:09 PM: ❯ Context
6:01:09 PM:   production
6:01:09 PM: ​
6:01:09 PM: ┌────────────────────────────────┐
6:01:09 PM: │ 1. Build command from settings │
6:01:09 PM: └────────────────────────────────┘
6:01:09 PM: ​
6:01:09 PM: $ gatsby build
6:01:12 PM: 
6:01:12 PM: 
6:01:12 PM: success open and validate gatsby-configs - 0.071s
6:01:14 PM: success load plugins - 1.503s
6:01:14 PM: success onPreInit - 0.011s
6:01:14 PM: success delete html and css files from previous builds - 0.014s
6:01:14 PM: 
6:01:14 PM: success initialize cache - 0.011s
6:01:14 PM: success copy gatsby files - 0.029s
6:01:14 PM: 
6:01:14 PM: success onPreBootstrap - 0.010s
6:01:14 PM: success createSchemaCustomization - 0.111s
6:01:15 PM: 
6:01:15 PM: success source and transform nodes - 0.861s
6:01:15 PM: 
6:01:15 PM: success building schema - 0.543s
6:01:16 PM: 
6:01:16 PM: success createPages - 0.306s
6:01:16 PM: success createPagesStatefully - 0.087s
6:01:16 PM: success onPreExtractQueries - 0.000s
6:01:16 PM: 
6:01:16 PM: success update schema - 0.050s
6:01:16 PM: 
6:01:16 PM: success extract queries from components - 0.497s
6:01:16 PM: 
6:01:16 PM: warning The GraphQL query in the non-page component "/opt/build/repo/src/templates/page.js" will not be run.
6:01:16 PM: Exported queries are only executed for Page components. It's possible you're
6:01:16 PM: trying to create pages in your gatsby-node.js and that's failing for some
6:01:16 PM: reason.
6:01:16 PM: If the failing component(s) is a regular component and not intended to be a page
6:01:16 PM: component, you generally want to use a <StaticQuery> (https://gatsbyjs.org/docs/static-query)
6:01:16 PM: instead of exporting a page query.
6:01:16 PM: If you're more experienced with GraphQL, you can also export GraphQL
6:01:16 PM: fragments from components and compose the fragments in the Page component
6:01:16 PM: query and pass data down into the child component — https://graphql.org/learn/queries/#fragments
6:01:16 PM: 
6:01:16 PM: success write out requires - 0.007s
6:01:16 PM: 
6:01:16 PM: success write out redirect data - 0.001s
6:01:16 PM: 
6:01:16 PM: success Build manifest and related icons - 0.209s
6:01:16 PM: success onPostBootstrap - 0.211s
6:01:16 PM: ⠀
6:01:16 PM: 
6:01:16 PM: info bootstrap finished - 7.335s
6:01:16 PM: ⠀
6:01:17 PM: 
6:01:17 PM: success run static queries - 0.388s - 1/1 2.58/s
6:01:47 PM: 
6:01:47 PM: failed Building production JavaScript and CSS bundles - 29.700s
6:01:47 PM: 
6:01:47 PM: error Generating JavaScript bundles failed
6:01:47 PM: Can't resolve '../components/seo' in '/opt/build/repo/src/pages'
6:01:47 PM: If you're trying to use a package make sure that '../components/seo' is installed. If you're trying to use a local file make sure that the path is correct.
6:01:47 PM: not finished Generating image thumbnails - 30.067s
6:01:47 PM: ​
6:01:47 PM: ┌─────────────────────────────┐
6:01:47 PM: │   "build.command" failed    │
6:01:47 PM: └─────────────────────────────┘
6:01:47 PM: ​
6:01:47 PM:   Error message
6:01:47 PM:   Command failed with exit code 1: gatsby build
6:01:47 PM: ​
6:01:47 PM:   Error location
6:01:47 PM:   In Build command from settings:
6:01:47 PM:   gatsby build
6:01:47 PM: ​
6:01:47 PM:   Resolved config
6:01:47 PM:   build:
6:01:47 PM:     command: gatsby build
6:01:47 PM:     publish: /opt/build/repo/public
6:01:47 PM: Caching artifacts
6:01:47 PM: Started saving node modules
6:01:47 PM: Finished saving node modules
6:01:47 PM: Started saving build plugins
6:01:47 PM: Finished saving build plugins
6:01:47 PM: Started saving pip cache
6:01:47 PM: Finished saving pip cache
6:01:47 PM: Started saving emacs cask dependencies
6:01:47 PM: Finished saving emacs cask dependencies
6:01:47 PM: Started saving maven dependencies
6:01:47 PM: Finished saving maven dependencies
6:01:47 PM: Started saving boot dependencies
6:01:47 PM: Finished saving boot dependencies
6:01:47 PM: Started saving go dependencies
6:01:47 PM: Finished saving go dependencies
6:01:51 PM: Error running command: Build script returned non-zero exit code: 1
6:01:51 PM: Failing build: Failed to build site
6:01:51 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
6:01:51 PM: Finished processing build request in 2m35.563500921s

我尝试了以下解决方案,

  1. 清理缓存并重新部署。
  2. 删除 Gatsby-CLI 并重新部署。

参考以下解决方案 1、2

本地设置似乎运行良好,没有问题。已经使用它一段时间了,知道我做错了什么吗?

在我的机器上,尝试在 Netlify 上构建时出现以下错误。事实证明,进口情况参差不齐。我有一个文件期待....组件/布局,但实际文件被命名为布局(无大写(。跟踪实例后,部署成功。祝你好运!

最新更新