oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
71.77k stars 2.55k forks source link

Bun not installing proper architecture package on Apple Silicon (M1) #9149

Open ebektasiadis opened 4 months ago

ebektasiadis commented 4 months ago

What version of Bun is running?

1.0.29+a146856d1

What platform is your computer?

Darwin 23.2.0 x86_64 i386

What steps can reproduce the bug?

I am trying to create a project with Rsbuild. I install the dependencies from package.json with bun install but when I do bun dev I get an error.

bun create rsbuild@latest
cd my-project
bun install
bun dev

What is the expected behavior?

The expected behavior is the webpack-dev-server to begin.

What do you see instead?

$ rsbuild dev --open
  Rsbuild v0.4.8

node:internal/modules/cjs/loader:1144
  const err = new Error(message);
              ^

Error: Cannot find module '@rspack/binding-darwin-x64'
Require stack:
- /Users/..../my/node_modules/@rspack/binding/binding.js
- /Users/..../my/node_modules/@rspack/core/dist/Chunk.js
- /Users/..../my/node_modules/@rspack/core/dist/config/zod.js
- /Users/..../my/node_modules/@rspack/core/dist/config/index.js
- /Users/..../my/node_modules/@rspack/core/dist/rspack.js
- /Users/..../my/node_modules/@rspack/core/dist/index.js
- /Users/..../my/node_modules/@rsbuild/core/dist/provider/rspackConfig.js
- /Users/..../my/node_modules/@rsbuild/core/dist/provider/initConfigs.js
- /Users/..../my/node_modules/@rsbuild/core/dist/provider/provider.js
- /Users/..../my/node_modules/@rsbuild/core/dist/provider/index.js
- /Users/..../my/node_modules/@rsbuild/core/dist/createRsbuild.js
- /Users/..../my/node_modules/@rsbuild/core/dist/index.js
- /Users/..../my/rsbuild.config.ts

Additional information

I am running iTerm with Rosetta 2. I have installed brew as x86. I have installed node through nvm. Version 20.11.1. When executing node 'console.log(process.arch), I get x64

When trying to install dependencies with pnpm everything works as it should. After I install with pnpm the dependencies, if I do bun dev it works as expected.

Electroid commented 4 months ago

Your bun is the M1 version (aarch64), but your node is the x64 version. What happens when you run: bun -e 'console.log(process.arch)'?

The solution would be to install the aarch64 version of node.

ebektasiadis commented 4 months ago

Your bun is the M1 version (aarch64), but your node is the x64 version. What happens when you run: bun -e 'console.log(process.arch)'?

The solution would be to install the aarch64 version of node.

Thank you @Electroid for your answer! bun -e 'console.log(process.arch)' gives me arm64.

I saw some progress by installing Node with arm64, but still I get Error: Cannot find module 'ajv/dist/compile/codegen'

I installed it manually, and it works. But why it does not install itself as it seems to be a dependency? pnpm installs it without having to define it inside package.json