«gatsby-source-wordpress» выдавал ошибку при запуске жизненного цикла sourceNodes при развертывании в Netlify - PullRequest
0 голосов
/ 24 января 2020

Описание

Я вижу, что ошибка "" gatsby-source-wordpress "вызвала ошибку при запуске жизненного цикла sourceNodes", "Невозможно прочитать свойство 'данные' из неопределенного" при развертывании в Netlify. Я просматривал предыдущую проблему, которая была похожей, но ни одно из предложений не устранило эту проблему.

Шаги для воспроизведения

Я использую Local by Flywheel для размещения моего wordpress локально по URL " http://headless.local/». Он загружает данные в мой сайт Gatsby локально по URL-адресу "http://localhost: 8000 / " по команде разработки gatsby и правильно строит его по команде сборки gatsby.

Это мой gatsby-config. js

module.exports = {
  siteMetadata: {
    title: `WordPress + Gatsby`,
    description: `Headless wordpress plus Gatsby.`,
    author: `@andy_gilliland`,
  },
  plugins: [
    `gatsby-plugin-netlify`,
    {
      resolve: `gatsby-source-wordpress`,
      options: {
        baseUrl: `headless.local/`,
        protocol: `http`,
        hostingWPCOM: false,
        useACF: true,
      },
    },
    `gatsby-plugin-react-helmet`,
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `images`,
        path: `${__dirname}/src/images`,
      },
    },
    `gatsby-transformer-sharp`,
    `gatsby-plugin-sharp`,
    {
      resolve: `gatsby-plugin-manifest`,
      options: {
        name: `gatsby-starter-default`,
        short_name: `starter`,
        start_url: `/`,
        background_color: `#663399`,
        theme_color: `#663399`,
        display: `minimal-ui`,
        icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
      },
    },
    // this (optional) plugin enables Progressive Web App + Offline functionality
    // To learn more, visit: https://gatsby.dev/offline
    // `gatsby-plugin-offline`,
  ],
}

Ожидаемый результат

Должен быть развернут в Netlify.

Фактический результат

Это был точка в журнале развертывания Netlify, где произошла ошибка.

9:23:21 AM: The request failed with error code "ENOTFOUND"
9:23:21 AM: error "gatsby-source-wordpress" threw an error while running the sourceNodes lifecycle:
9:23:21 AM: Cannot read property 'data' of undefined
9:23:21 AM: 
9:23:21 AM:   TypeError: Cannot read property 'data' of undefined
9:23:21 AM:   
9:23:21 AM:   - fetch.js:141 fetch
9:23:21 AM:     [repo]/[gatsby-source-wordpress]/fetch.js:141:21
9:23:21 AM:   
9:23:21 AM:   - next_tick.js:68 process._tickCallback
9:23:21 AM:     internal/process/next_tick.js:68:7
9:23:21 AM:   
9:23:21 AM: 
9:23:21 AM: not finished source and transform nodes - 0.105s
9:23:21 AM: Skipping functions preparation step: no functions directory set
9:23:21 AM: Caching artifacts
9:23:21 AM: Started saving node modules
9:23:21 AM: Finished saving node modules
9:23:21 AM: Started saving pip cache
9:23:21 AM: Finished saving pip cache
9:23:21 AM: Started saving emacs cask dependencies
9:23:21 AM: Finished saving emacs cask dependencies
9:23:21 AM: Started saving maven dependencies
9:23:21 AM: Finished saving maven dependencies
9:23:21 AM: Started saving boot dependencies
9:23:21 AM: Finished saving boot dependencies
9:23:21 AM: Started saving go dependencies
9:23:21 AM: Finished saving go dependencies
9:23:24 AM: Error running command: Build script returned non-zero exit code: 1
9:23:24 AM: Failing build: Failed to build site
9:23:24 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
9:23:24 AM: Finished processing build request in 1m5.054565857s

Среда

System:
OS: Windows 10
CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
Binaries:
Yarn: 1.17.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 44.18362.449.0
npmPackages:
gatsby: ^2.19.4 => 2.19.4
gatsby-image: ^2.2.39 => 2.2.39
gatsby-plugin-manifest: ^2.2.38 => 2.2.38
gatsby-plugin-netlify: ^2.1.31 => 2.1.31
gatsby-plugin-offline: ^2.2.10 => 2.2.10
gatsby-plugin-react-helmet: ^3.1.21 => 3.1.21
gatsby-plugin-sharp: ^2.4.0 => 2.4.0
gatsby-source-filesystem: ^2.1.46 => 2.1.46
gatsby-source-wordpress: ^3.1.58 => 3.1.58
gatsby-transformer-sharp: ^2.3.13 => 2.3.13
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...