Gatsby 构建失败,生成 SSR 包失败

问题描述 投票:0回答:1

当我在计算机上本地运行 Gatsby build 时,出现以下错误(请参阅日志)。看起来像是 webpack 错误。

盖茨比配置:

/**
 * @type {import('gatsby').GatsbyConfig}
 */
module.exports = {
  flags: {
    DEV_SSR: true,
  },
  plugins: [
    {
      resolve: "gatsby-source-wordpress",
      options: {
        verbose: true,
        url: `https://*********/graphql`,
        schema: {
          queryDepth: 30,
          circularQueryLimit: 15,
          timeout: 60000,
          requestConcurrency: 150,
        },
        production: {
          allow404Images: true,
          allow401Images: true,
        },
      },
    },
    `gatsby-plugin-netlify`,
    "gatsby-plugin-image",
    "gatsby-plugin-sharp",
    "gatsby-plugin-web-font-loader",
    "gatsby-transformer-sharp",
    "gatsby-plugin-postcss",
    "gatsby-plugin-sitemap",
    {
      resolve: "gatsby-plugin-manifest",
      options: {
        icon: "src/images/favicon-32x32.png",
      },
    },
    {
      resolve: "gatsby-source-filesystem",
      options: {
        name: "images",
        path: "./src/images/",
      },
    },
  ],
};

package.json:

{
  "dependencies": {
    "@fontsource/lato": "^5.0.16",
    "@headlessui/react": "^1.7.17",
    "autoprefixer": "^10.4.16",
    "axios": "^1.5.1",
    "firebase": "^10.5.0",
    "formik": "^2.4.5",
    "framer-motion": "^10.16.4",
    "gatsby": "^5.12.4",
    "gatsby-plugin-image": "^3.12.1",
    "gatsby-plugin-manifest": "^5.12.1",
    "gatsby-plugin-matomo": "^0.16.2",
    "gatsby-plugin-netlify": "^5.1.1",
    "gatsby-plugin-postcss": "^6.12.0",
    "gatsby-plugin-sharp": "^5.12.1",
    "gatsby-plugin-sitemap": "^6.12.1",
    "gatsby-plugin-web-font-loader": "^1.0.4",
    "gatsby-source-filesystem": "^5.12.0",
    "gatsby-source-wordpress": "^7.12.1",
    "gatsby-transformer-sharp": "^5.12.1",
    "lodash": "^4.17.21",
    "postcss": "^8.4.31",
    "react": "^18.2.0",
    "react-animations": "^1.0.0",
    "react-cookie-consent": "^9.0.0",
    "react-dom": "^18.2.0",
    "react-helmet": "^6.1.0",
    "react-responsive-carousel": "^3.2.23",
    "swiper": "^10.3.1",
    "tailwindcss": "^3.3.3",
    "yup": "^1.3.2"
  }
}

日志:

ERROR #98123  WEBPACK.BUILD-HTML

Generating SSR bundle failed

Reading from "node:events" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.

File: node:events


 ERROR #98123  WEBPACK.BUILD-HTML

Generating SSR bundle failed

Reading from "node:stream" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.

File: node:stream


 ERROR #98123  WEBPACK.BUILD-HTML

Generating SSR bundle failed

Reading from "node:util" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.

File: node:util
node.js webpack build gatsby
1个回答
0
投票

检查另一个 Firebase 版本。我在 10.7.1 上遇到问题...恢复到 10.6.0 并且构建工作正常。

© www.soinside.com 2019 - 2024. All rights reserved.