react-static: Yarn build fails on Netlify

Hello,

i have tried to create a starter site using react-static create (basic template) and all was fine under my Win10 dev machine.

However when trying to deploy on netlify (which is runnin linux) I get the following error:

6:03:12 PM: $ react-static build
6:03:13 PM: module.js:540
6:03:13 PM:     throw err;
6:03:13 PM:     ^
6:03:13 PM: Error: Cannot find module 'set-immediate-shim'
6:03:13 PM:     at Function.Module._resolveFilename (module.js:538:15)
6:03:13 PM:     at Function.Module._load (module.js:468:25)
6:03:13 PM:     at Module.require (module.js:587:17)
6:03:13 PM:     at require (internal/module.js:11:18)
6:03:13 PM:     at Object.<anonymous> (/opt/build/repo/node_modules/readdirp/readdirp.js:7:18)
6:03:13 PM:     at Module._compile (module.js:643:30)
6:03:13 PM:     at Module._extensions..js (module.js:654:10)
6:03:13 PM:     at Object.require.extensions.(anonymous function) [as .js] (/opt/build/repo/node_modules/babel-register/lib/node.js:152:7)
6:03:13 PM:     at Module.load (module.js:556:32)
6:03:13 PM:     at tryModuleLoad (module.js:499:12)
6:03:13 PM: error Command failed with exit code 1.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

Thanks to everyone do the help

Just got this from netlify:

We currently have a suboptimal setting in place which we’re working to remove which is probably what’s breaking your build. You’ll want to override it in this case and I think that will clear up the problem for you.

The setting we set is “–ignore-optional” and to override that, set a YARN_FLAGS Build Environment Variable (most easily on your build & deploy settings page, second configuration card - also possible in netlify.toml if you use that).

You should set it to “–no-ignore-optional” and I suspect your build will work better. We’ll change the default shortly, but for the meantime, that should help your build succeed.

Let me know how it goes!

I’ll try as soon as I can. Thanks for the help