【发布时间】:2019-11-14 14:07:13
【问题描述】:
盖茨比-源-WordPress 盖茨比开发 返回: "服务器响应为 "404 Not Found"
运行 Gatsby 默认启动器 在 localhost 上全新安装 wordpress。
wordpress 在这里:localhost/freshinstall 我在这里看到 json 数据:localhost/freshinstall/wp-json/ wordpress 中的永久链接设置为:帖子名称
gatsby-source-wordpress 是 gatsby 中唯一安装的插件:
{
resolve: `gatsby-source-wordpress`,
options: {
// your wordpress source
baseUrl: `localhost/freshinstall`,
protocol: `http`,
hostingWPCOM: false,
useACF: true
}
},
希望能够访问 wordPress 中的信息。
以下是我看到的:
my-default-starter dk$ gatsby develop
success open and validate gatsby-configs - 0.067 s
success load plugins - 42.771 s
success onPreInit - 0.034 s
success initialize cache - 0.061 s
success copy gatsby files - 2.423 s
success onPreBootstrap - 0.052 s
Path: /freshinstall/wp-json
The server response was "404 Not Found"
ERROR
Plugin gatsby-source-wordpress returned an error Cannot read property 'data' of undefined
TypeError: Cannot read property 'data' of undefined
- fetch.js:134 fetch
[my-default-starter]/[gatsby-source-wordpress]/fetch.js:134:21
- next_tick.js:68 process._tickCallback
internal/process/next_tick.js:68:7
warn The gatsby-source-wordpress plugin has generated no Gatsby nodes. Do you need it?
success source and transform nodes - 1.840 s
success building schema - 1.270 s
success createPages - 0.007 s
success createPagesStatefully - 1.266 s
success onPreExtractQueries - 0.089 s
success update schema - 0.078 s
success extract queries from components - 25.299 s
success write out requires - 0.165 s
success write out redirect data - 0.044 s
success Build manifest and related icons - 0.402 s
success onPostBootstrap - 0.458 s
⠀
info bootstrap finished - 269.881 s
⠀
success Generating image thumbnails — 6/6 - 2.762 s
success run static queries - 3.311 s — 3/3 0.91 queries/second
success run page queries - 0.077 s — 5/5 93.18 queries/second
DONE Compiled successfully in 105741ms 3:25:50 PM
⠀
You can now view gatsby-starter-default in the browser.
⠀
http://localhost:8000/
⠀
View GraphiQL, an in-browser IDE, to explore your site's data and schema
⠀
http://localhost:8000/___graphql
⠀
Note that the development build is not optimized.
To create a production build, use npm run build
⠀
ℹ 「wdm」:
ℹ 「wdm」: Compiled successfully.
【问题讨论】: