"Webpack ERROR #98123 Reading from "node:path" is not handled by plugins" on gasby build

Hello all

I’m getting strange errors when trying to do production build of gatsby site.

 ERROR #98123  WEBPACK.BUILD-HTML

Generating SSR bundle failed

Reading from "node:path" 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:path


 ERROR #98123  WEBPACK.BUILD-HTML

Generating SSR bundle failed

Reading from "node:process" 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:process

                                                                                                                                                                                                                       
 ERROR #98123  WEBPACK.BUILD-HTML                                                                                                                                                                                      

Generating SSR bundle failed

Reading from "node:url" 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:URL

not finished Running gatsby-plugin-sharp.IMAGE_PROCESSING jobs - 18.258s
not finished Building HTML renderer - 2.520s

No more information would suggest what the problem is. I spent some time going through various ideas, reinstalled Gatsby CLI, removed node_modules, and removed the package.lock. Nothing helps.

The develop build works fine, site is working as expected, it’s the production build. Just to double check I created a new site in Netlify and it fails with the same errors.

The repo is here https://github.com/jimmylarkin/freedom-moto-web/tree/file-system

Interesting, I just ran into this same thing today.

I wonder if there’s a peer dependency that we both use that is messing with our build…

 "dependencies": {
    "@emotion/react": "^11.11.1",
    "@emotion/server": "latest",
    "@emotion/styled": "^11.11.0",
    "@mdx-js/mdx": "^2.3.0",
    "@mdx-js/react": "^2.3.0",
    "@mui/material": "^5.14.12",
    "dotenv": "^16.3.1",
    "eslint-plugin-react-refresh": "^0.4.3",
    "eslint-plugin-storybook": "^0.6.14",
    "gatsby": "^5.12.5",
    "gatsby-plugin-emotion": "^8.12.0",
    "gatsby-plugin-google-analytics": "^5.12.0",
    "gatsby-plugin-image": "^3.12.0",
    "gatsby-plugin-mdx": "^5.12.0",
    "gatsby-plugin-sharp": "^5.12.0",
    "gatsby-plugin-sitemap": "^6.12.0",
    "gatsby-source-contentstack": "^5.1.0",
    "gatsby-source-filesystem": "^5.12.0",
    "gatsby-transformer-sharp": "^5.12.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-markdown": "^9.0.0"
  },
  "devDependencies": {
    "@storybook/addon-actions": "^6.5.16",
    "@storybook/addon-essentials": "^6.5.16",
    "@storybook/addon-interactions": "^6.5.16",
    "@storybook/addon-links": "^6.5.16",
    "@storybook/builder-webpack5": "^6.5.16",
    "@storybook/manager-webpack5": "^6.5.16",
    "@storybook/node-logger": "^6.5.16",
    "@storybook/preset-create-react-app": "^4.1.2",
    "@storybook/react": "^6.5.16",
    "@storybook/testing-library": "^0.0.13",
    "@trivago/prettier-plugin-sort-imports": "^4.2.0",
    "prettier": "^3.0.3",
    "rimraf": "^5.0.5"
  },

Ah ha! That’s what it was, it’s one of the dependencies, I just don’t know which one just yet.

It’s It’s react-markdown, worked fine with older 8 version.

You are a genius! What’s the solution? Exclude it from webpack config in gatsby-node.js? Or downgrade version?

Downgraded to 8.0.7, and all is good

hello I’ve just run into this issue and don’t know really where it came from?!

As followed my log files from netlify:
error Generating SSR bundle failed
6:56:01 PM: Reading from “node:util” is not handled by plugins (Unhandled scheme).
6:56:01 PM: Webpack supports “data:” and “file:” URIs by default.
6:56:01 PM: You may need an additional plugin to handle “node:” URIs.
6:56:01 PM: not finished Running gatsby.IMAGE_CDN jobs - 49.905s
6:56:01 PM: not finished Building HTML renderer - 3.783s
6:56:03 PM: Failed during stage “building site”: Build script returned non-zero exit code: 2
6:56:02 PM: ​
6:56:02 PM: “build.command” failed
6:56:02 PM: ────────────────────────────────────────────────────────────────
6:56:02 PM: ​
6:56:02 PM: Error message
6:56:02 PM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
6:56:02 PM: ​
6:56:02 PM: Error location
6:56:02 PM: In Build command from Netlify app:
6:56:02 PM: npm run build
6:56:02 PM: ​
6:56:02 PM: Resolved config
6:56:02 PM: build:
6:56:02 PM: command: npm run build
6:56:02 PM: commandOrigin: ui
6:56:02 PM: publish: /opt/build/repo/public
6:56:02 PM: publishOrigin: ui
6:56:03 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:56:03 PM: Failing build: Failed to build site
6:56:03 PM: Finished processing build request in 2m24.062s

My 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-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"
  }

Can someone please help me further?

I am facing the same issue @littlefengers If I downgrade react-markdown then this plugin remark-gfm of react-markdown is not working I have to use react-markdown latest version to use that plugin any solution for that please

As found above, it’s a problem with one of the dependencies, not Netlify. We cannot fix this for you.

It’s a little strange because sometimes the builds are successful and sometimes I get the error message from above. Although the package.json were the same @hrishikesh