Im facing issue with ESBuild during yarn install step
Oct. 24 05:43:03 PM error esbuild-darwin-arm64@0.15.12: The platform "linux" is incompatible with this module.
Oct. 24 05:43:03 PM error esbuild-darwin-arm64@0.15.12: The CPU architecture "x64" is incompatible with this module.
Oct. 24 05:43:03 PM error Found incompatible module.
Oct. 24 05:43:03 PM info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Oct. 24 05:43:03 PM rake aborted!
Oct. 24 05:43:03 PM jsbundling-rails: Command build failed, ensure yarn is installed and `yarn build` runs without errors
Oct. 24 05:43:03 PM /opt/render/project/.gems/ruby/3.0.0/gems/jsbundling-rails-1.0.3/lib/tasks/jsbundling/build.rake:5:in `block (2 levels) in <main>'
I use MacOS for development thus esbuild-darwin-arm64 is in the package.json file. I guess render is expecting esbuild-linux-64. How can I fix this issue?
Certainly, to fix differences between platforms for bundler you need to perform
bundle lock --add-platform x86_64-linux
I checked in my own Rails7 app which uses esbuild and there’s nothing platform specific in my package.json but I can see other platforms in my yarn.lock - and I’m also using an M1 Mac here,
Ah, re-reading the error based on your snipper of package.json there, I suspect the issue here is that you explicitly have the darwin-arm64 module in your package.json which will indeed work locally but not on us (or any Linux x86 platform).
My own package.json for a Rail7 app I deploy to us is;