1

我正在使用飞轮(url:xyz.local)的wordpress网站Local。我使用并添加了 gatsby-source-woocommerce 创建了一个新的 gatsby 站点。我还从 woo-commerce 设置中生成了消费者密钥和消费者秘密。我将它们添加到配置文件中的 api_keys 中。

当我运行 gastby develop 时,我得到了这个错误。

========== WARNING FOR FIELD products ===========
The following error status was produced: Error: connect ECONNREFUSED 127.0.0.1:8080
================== END WARNING ==================

08:19:23.204Z > gatsby-source-woocommerce: Fetching 0 nodes for field: products
08:19:23.206Z > gatsby-source-woocommerce: Completed fetching nodes for field: products
warn
========== WARNING FOR FIELD products/categories ===========
The following error status was produced: Error: connect ECONNREFUSED 127.0.0.1:8080
================== END WARNING ==================

08:19:23.213Z > gatsby-source-woocommerce: Fetching 0 nodes for field: products/categories
08:19:23.215Z > gatsby-source-woocommerce: Completed fetching nodes for field: products/categories
warn
========== WARNING FOR FIELD products/attributes ===========
The following error status was produced: Error: connect ECONNREFUSED 127.0.0.1:8080
================== END WARNING ==================

有人可以说我是否错过了什么?还是我做错了什么?

4

1 回答 1

0

我解决了。问题出在插件上。在 gatsby-source-woocommerce 的配置选项中,在字段之后评论所有内容,即评论后看起来像,

{
      resolve: "@pasdo501/gatsby-source-woocommerce",
      options: {

        // Base URL of Wordpress site

        api: "wordpress.domain",

        // set to false to not see verbose output during build
        // default: true
        verbose: true,

        // true if using https. otherwise false.
        https: false,
        api_keys: {
          consumer_key: <key>,
          consumer_secret: <secret>,
        },
        // Array of strings with fields you'd like to create nodes for...
        fields: ["products", "products/categories", "products/attributes"],

       
      },
    },

前往@pasdo501/gatsby-source-woocommerce 文件夹(节点模块)-> gatsby-node.js 将 api_version = "wc/v3" 更改为 "wc/v2" 并将 wpAPIPrefix = null 更改为 "wp-json" 并保存它。

于 2020-09-15T11:53:08.347 回答