前提
Rails 7.0.4
ruby 3.2.0
node 18.13.0
Ruby on Rails初学者です。
rails sでサーバーを立ち上げることはできるのですが、bin/devを実行した際にerrorが出てしまいます。
esbuildが動いていないように思うのですが、自分では解決できなかったため質問させていただきます。
実現したいこと
- bin/dev でサーバーを立ち上げてbuildする
発生している問題・エラーメッセージ
bin/dev 14:26:22 web.1 | started with pid 43688 14:26:22 js.1 | started with pid 43689 14:26:23 js.1 | yarn run v1.22.19 14:26:23 js.1 | $ node esbuild.config.js --watch 14:26:26 js.1 | /Users/seoakirahajime/Documents/Cajon/Hairbook/node_modules/esbuild/lib/main.js:1841 14:26:26 js.1 | throw new Error(` 14:26:26 js.1 | ^ 14:26:26 js.1 | 14:26:26 js.1 | Error: 14:26:26 js.1 | You installed esbuild for another platform than the one you're currently using. 14:26:26 js.1 | This won't work because esbuild is written with native code and needs to 14:26:26 js.1 | install a platform-specific binary executable. 14:26:26 js.1 | 14:26:26 js.1 | Specifically the "@esbuild/darwin-arm64" package is present but this platform 14:26:26 js.1 | needs the "@esbuild/darwin-x64" package instead. People often get into this 14:26:26 js.1 | situation by installing esbuild with npm running inside of Rosetta 2 and then 14:26:26 js.1 | trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta 14:26:26 js.1 | 2 is Apple's on-the-fly x86_64-to-arm64 translation service). 14:26:26 js.1 | 14:26:26 js.1 | If you are installing with npm, you can try ensuring that both npm and node are 14:26:26 js.1 | not running under Rosetta 2 and then reinstalling esbuild. This likely involves 14:26:26 js.1 | changing how you installed npm and/or node. For example, installing node with 14:26:26 js.1 | the universal installer here should work: https://nodejs.org/en/download/. Or 14:26:26 js.1 | you could consider using yarn instead of npm which has built-in support for 14:26:26 js.1 | installing a package on multiple platforms simultaneously. 14:26:26 js.1 | 14:26:26 js.1 | If you are installing with yarn, you can try listing both "arm64" and "x64" 14:26:26 js.1 | in your ".yarnrc.yml" file using the "supportedArchitectures" feature: 14:26:26 js.1 | https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures 14:26:26 js.1 | Keep in mind that this means multiple copies of esbuild will be present. 14:26:26 js.1 | 14:26:26 js.1 | Another alternative is to use the "esbuild-wasm" package instead, which works 14:26:26 js.1 | the same way on all platforms. But it comes with a heavy performance cost and 14:26:26 js.1 | can sometimes be 10x slower than the "esbuild" package, so you may also not 14:26:26 js.1 | want to do that. 14:26:26 js.1 | 14:26:26 js.1 | at generateBinPath (/Users/seoakirahajime/Documents/Cajon/Hairbook/node_modules/esbuild/lib/main.js:1841:17) 14:26:26 js.1 | at esbuildCommandAndArgs (/Users/seoakirahajime/Documents/Cajon/Hairbook/node_modules/esbuild/lib/main.js:1922:33) 14:26:26 js.1 | at ensureServiceIsRunning (/Users/seoakirahajime/Documents/Cajon/Hairbook/node_modules/esbuild/lib/main.js:2087:25) 14:26:26 js.1 | at Object.build (/Users/seoakirahajime/Documents/Cajon/Hairbook/node_modules/esbuild/lib/main.js:1978:26) 14:26:26 js.1 | at file:///Users/seoakirahajime/Documents/Cajon/Hairbook/esbuild.config.js:22:9 14:26:26 js.1 | at ModuleJob.run (node:internal/modules/esm/module_job:197:25) 14:26:26 js.1 | at async Promise.all (index 0) 14:26:26 js.1 | at async ESMLoader.import (node:internal/modules/esm/loader:337:24) 14:26:26 js.1 | at async loadESM (node:internal/process/esm_loader:88:5) 14:26:26 js.1 | at async handleMainPromise (node:internal/modules/run_main:61:12) 14:26:26 js.1 | error Command failed with exit code 1. 14:26:26 js.1 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. 14:26:26 js.1 | exited with code 1 14:26:26 system | sending SIGTERM to all processes 14:26:26 web.1 | terminated by SIGTERM
installしたpackageが違うと言われているのですが、よく分からず解決できてないです。
環境構築についての知識がほとんどないため、教えていただけたら助かります。
回答2件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
また依頼した内容が修正された場合は、修正依頼を取り消すようにしましょう。