hupe1980 / gatsby-plugin-material-ui

Gatsby plugin for Material-UI with built-in server-side rendering support
MIT License
136 stars 24 forks source link

Support Yarn PNP / Plug'n'Play #46

Closed nolandg closed 4 years ago

nolandg commented 4 years ago

It seems this package tries to write to a .cache folder within node_modules. Using Yarn 2 Plug'n'Play this doesn't work as that is a read-only virtual file system so the build fails. Can you do like most other modules and store your .cache in the project directory instead? Or am I missing something?

Thanks for the great plugin!

"gatsby-plugin-material-ui" threw an error while running the onPreBootstrap lifecycle:

EROFS: read-only filesystem, mkdir '/node_modules/gatsby-plugin-material-ui/.cache'

  36 | 
  37 |   if (!fs.existsSync(dir)) {
> 38 |     fs.mkdirSync(dir);
     |        ^
  39 |   }
  40 | 
  41 |   fs.writeFileSync(dir + "/styles-provider-props.js", module);

File: .yarn/$$virtual/gatsby-plugin-material-ui-virtual-1b8deca526/0/cache/gatsby-plugin-material-ui-npm-2.1.6-fc64177c4c-2.zip/node_modules/gatsby-plugin-material-ui/gatsby-node.js:38:8

  Error: EROFS: read-only filesystem, mkdir '/node_modules/gatsby-plugin-material-ui/.cache'
  - .pnp.js:27535 makeError
    /home/noland/projects/acdc-shop/.pnp.js:27535:24
nolandg commented 4 years ago

The workaround is to force Yarn to unplug this module: https://yarnpkg.com/cli/unplug by running yarn unplug gatsby-plugin-material-ui before yarn build gatsby

hugoelizandro commented 4 years ago

The problem started to occur with the new version of node, I had to rollback to 13.13.0

oliviertassinari commented 4 years ago

Do we have a reproduction to investigate?

hupe1980 commented 4 years ago

We have to switch to Gatsby's cache logic. I will create a PR