Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unsafe builtin method was used, future builds will need to rebuild all pages - gatsby build

Tags:

gatsby

I am facing this error during "gatsby build"

warning Unsafe builtin method was used, future builds will need to rebuild all pages warning WebpackError: Unsafe builtin usage fs.existsSync

please check the picture and package details below..

Package.Json

 "gatsby": "^3.1.1",
    "gatsby-plugin-create-client-paths": "^3.2.0",
    "gatsby-plugin-material-ui": "^3.0.1",
    "gatsby-plugin-typescript": "^3.2.0",
    "gatsby-source-contentful": "^5.2.1",
    "react": "^17.0.1",
    "react-chartjs-2": "^2.11.1",
    "react-dom": "^17.0.1",
    "react-redux": "^7.2.3",
    "storybook": "^6.2.8",
    "storybook-css-modules-preset": "^1.0.7",
    "typeface-roboto": "^1.1.13",
    "typescript": "^4.2.3",
    "yup": "^0.32.9"
like image 746
Irfan Ahmed Avatar asked Dec 13 '25 02:12

Irfan Ahmed


1 Answers

The issue is caused by gatsby-plugin-material-ui plugin. You can follow the stack trace of the warning discussion here.

The resolution is to update the gatsby-plugin-material-ui to 3.0.0 version.

In your case, try downgrading to 3.0.0 rather than using 3.0.1. Remove your node_modules before each trial and remove your cache by gatsby clean.

Alternatively, you can try disabling the auto prefixing (not ideal solution):

{
  resolve: `gatsby-plugin-material-ui`,
  options: {
    disableAutoprefixing: true,
  },
},
like image 63
Ferran Buireu Avatar answered Dec 16 '25 22:12

Ferran Buireu