gatsby-source-wordpress插件无法生成节点问题求助
Hey there, let's work through this issue step by step—since you're new to Gatsby and WordPress integration, this is a common gotcha, so no worries!
Here are the key checks to fix the "no Gatsby nodes generated" warning:
Verify your plugin configuration in
gatsby-config.js
Make sure you've set up the plugin with the correct details for your self-hosted WordPress site. A basic valid config looks like this:plugins: [ { resolve: `gatsby-source-wordpress`, options: { baseUrl: `your-wordpress-site-domain.com`, // or local URL like localhost:8888/your-wp protocol: `https`, // switch to http if your site uses it hostingWPCOM: false, // this is critical for self-hosted WP (not WP.com) useACF: false, // set to true only if you're using Advanced Custom Fields }, }, ]If your WordPress is running locally, double-check that your local server (MAMP/XAMPP, etc.) is up and running, and that Gatsby can reach the WP URL without issues.
Confirm the WordPress REST API is accessible
Thegatsby-source-wordpressplugin relies on WordPress's REST API to pull data. Open your browser and visityour-wp-site-url/wp-json—you should see a large JSON response. If you get a 404 or error:- Switch to a default WordPress theme (like Twenty Twenty-One) to rule out theme conflicts
- Disable all third-party plugins on your WordPress site, as some might block the REST API
Check version compatibility
Your Gatsby version (1.1.39) is quite outdated, and newer versions ofgatsby-source-wordpressmay not support it. Try installing a plugin version that's compatible with Gatsby 1.x, for example:npm install gatsby-source-wordpress@3.xAlso, Node v8.9.4 is end-of-life—while it might work, upgrading to Node 12+ could resolve hidden compatibility issues down the line.
Clear Gatsby's cache and rebuild
Cached data can sometimes cause unexpected behavior. Run these commands in order:gatsby clean gatsby developThis will wipe old cached data and force Gatsby to fresh fetch data from WordPress.
Enable verbose logging for more clues
Run your develop command with the verbose flag to see detailed plugin logs:gatsby develop --verboseLook for error messages related to connecting to WordPress, authentication issues, or missing endpoints—this can point you directly to the root cause.
Following these steps should help you resolve the node generation issue. Start with the configuration and REST API checks, as those are the most common culprits!
内容的提问来源于stack exchange,提问作者ThierryBC

