我尝试将我的Gatsby / wordpress网站部署为netlify,但仍然遇到相同的问题。
11:06:17 PM:路径:/ wp-json
11:06:17 PM:服务器响应为“找不到404”
11:06:17 PM:错误插件gatsby-source-wordpress返回错误
11:06:17 PM:
11:06:17 PM:TypeError:无法读取未定义的属性'data'
11:06:17 PM:
11:06:17 PM:-fetch.js:141 fetch
11:06:17 PM:[repo] / [gatsby-source-wordpress] /fetch.js:141:21
11:06:17 PM:
11:06:17 PM:-next_tick.js:68进程._tickCallback
我尝试更改BaseURL,但仍然收到错误消息。
我的gatsby.config:
require('regenerator-runtime/runtime')
require('dotenv').config({
path: '.env',
});
const path = require('path');
module.exports = {
pathPrefix: `/mameri`,
siteMetadata: {
title: `quentinmameri`,
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
author: `@gatsbyjs`,
},
plugins: [
`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.
},
},
{
resolve: `gatsby-source-wordpress`,
options: {
/*
* The base URL of the Wordpress site without the trailingslash and the protocol. This is required.
* Example : 'gatsbyjsexamplewordpress.wordpress.com' or 'www.example-site.com'
*/
baseUrl: "qmavocats.wordpress.com",
// The protocol. This can be http or https.
protocol: "https",
// Indicates whether the site is hosted on wordpress.com.
// If false, then the assumption is made that the site is self hosted.
// If true, then the plugin will source its content on wordpress.com using the JSON REST API V2.
// If your site is hosted on wordpress.org, then set this to false.
hostingWPCOM: false,
// If useACF is true, then the source plugin will try to import the Wordpress ACF Plugin contents.
// This feature is untested for sites hosted on wordpress.com.
// Defaults to true.
useACF: true,
}
},
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// `gatsby-plugin-offline`,
],
}
我不知道为什么会有这个错误。感谢您的帮助。