错误:连接ECONNREFUSED 127.0.0.1:8080

时间:2020-09-11 10:05:31

标签: wordpress woocommerce gatsby woocommerce-rest-api gatsby-plugin

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

运行gastby开发工具时,出现此错误。

========== 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 ==================

有人可以说我是否想念什么吗?还是我做错了什么?

1 个答案:

答案 0 :(得分: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” 并保存它。