协助建立Gatsby和WordPress

时间:2019-12-18 00:37:09

标签: javascript reactjs wordpress authentication gatsby

我从事过多个Web开发项目,但从未真正组建一个(在我到达时已经完成了所有后端的设置)。

我正在建设一个网站,我需要一些指导,因为这个过程令我非常困惑。

我想将WordPress用作无头CMS(这样我仍然可以通过WP发布和管理该网站而无需编辑代码),并且我一直在寻找使用Gatsby.js。

我在WordPress.com上有一个网站(称为:mysite.wordpress.com)。我已经创建了我的Gatsby网站,很好地运行它,并安装了gatsby-source-wordpress软件包。最后,我的配置文件如下:

module.exports = {
  siteMetadata: { 
    title: `MySite`,
    description: `Testing`,
    author: `Me`
  }, 
  plugins: [
    {
      resolve: "gatsby-source-wordpress",
      options: {
        baseUrl: "mysite.wordpress.com",
        protocol: "http",
        hostingWPCOM: false,
        useACF: true,
        verboseOutput: true,
        auth: {
          htaccess_user: "xxxx@gmail.com", // My actual general WP account email  
          htaccess_pass: "yyyy",           // My actual general WP account pass. I know this is bad practice, I will put this into a dotenv file, I just want to make sure this works 
          htaccess_sendImmediately: false,
        },
      },
    },
  ]
}

但是,这不起作用,我不确定为什么。运行gatsby develop时,得到以下输出:

 ERROR #11321  PLUGIN

"gatsby-source-wordpress" threw an error while running the sourceNodes lifecycle:

Cannot convert undefined or null to object



  TypeError: Cannot convert undefined or null to object

  - Function.keys

  - fetch.js:534 getValidRoutes
    [emrose]/[gatsby-source-wordpress]/fetch.js:534:26

  - fetch.js:148 fetch
    [emrose]/[gatsby-source-wordpress]/fetch.js:148:23

  - task_queues.js:93 processTicksAndRejections
    internal/process/task_queues.js:93:5

  - gatsby-node.js:87 async Object.exports.sourceNodes
    [emrose]/[gatsby-source-wordpress]/gatsby-node.js:87:18

  - api-runner-node.js:235 async runAPI
    [emrose]/[gatsby]/dist/utils/api-runner-node.js:235:20

  - api-runner-node.js:328 async module.exports
    [emrose]/[gatsby]/dist/utils/api-runner-node.js:328:18

  - source-nodes.js:86 async module.exports
    [emrose]/[gatsby]/dist/utils/source-nodes.js:86:3

  - index.js:403 async module.exports
    [emrose]/[gatsby]/dist/bootstrap/index.js:403:3

  - develop.js:419 async module.exports
    [emrose]/[gatsby]/dist/commands/develop.js:419:7


warn The gatsby-source-wordpress plugin has generated no Gatsby nodes. Do you need it?

尽管经过数小时的谷歌搜索和youtube操作,但我仍不清楚如何继续进行操作,或者我是否可以使用这种格式访问我普通WP帐户中的网站。

我尝试在线寻找解决方案已经有一段时间了,但没有成功。请记住,我确实打算让该网站最终上线,有关后续步骤的任何指导都将很棒(:

0 个答案:

没有答案