Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Bindings not found on MacOS / NodeJS 20.16 for for ARM64 (M1/M2/M3 etc.) architecture #843

Open
webhype opened this issue Aug 17, 2024 · 2 comments

Comments

@webhype
Copy link

webhype commented Aug 17, 2024

Hello, having a bit of a challenging out-of-the box experience here...

How to reproduce:

index.ts:

console.log(process.arch, process.version);

package.json:

{
	"name": "test-swc",
	"version": "1.0.0",
	"description": "",
	"scripts": {
		"start": "node -r @swc-node/register index.ts",
		"test": "echo \"Error: no test specified\" && exit 1"
	},
	"keywords": [],
	"author": "",
	"license": "ISC",
	"devDependencies": {
		"@swc-node/register": "^1.10.9",
		"@types/node": "^22.4.0"
	}
}

Node version:

$ node -e 'console.log(process.arch, process.version);'
arm64 v20.16.0

swc-node version: 1.10.9 (see package.json)

Steps to reproduce:

$ npm install
$ npm run start

Expectation: That it output something like arm64 v20.16.0

Reality:

$ npm run start

> [email protected] start
> node -r @swc-node/register index.ts

/Users/macuser/mm/test-swc/node_modules/@swc/core/index.js:255
        throw new Error("Bindings not found");
        ^

Error: Bindings not found
    at Compiler.transformSync (/Users/macuser/mm/test-swc/node_modules/@swc/core/index.js:255:15)
    at transformSync (/Users/macuser/mm/test-swc/node_modules/@swc/core/index.js:356:21)
    at transformSync (/Users/macuser/mm/test-swc/node_modules/@swc-node/core/index.ts:93:26)
    at compile (/Users/macuser/mm/test-swc/node_modules/@swc-node/register/register.ts:111:40)
    at /Users/macuser/mm/test-swc/node_modules/@swc-node/register/register.ts:122:38
    at Module._compile (/Users/macuser/mm/test-swc/node_modules/pirates/lib/index.js:113:29)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Object.newLoader [as .ts] (/Users/macuser/mm/test-swc/node_modules/pirates/lib/index.js:121:7)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1024:12)

Node.js v20.16.0


@webhype
Copy link
Author

webhype commented Aug 17, 2024

If it wasn't clear from arm64 mentioned above, and /Users/macuser paths, the test was on Mac OS Ventura 13.6.7 (22G720), on an M2 chip with the arm64 version of NodeJS 20.16.0.

FWIW on Ubuntu 22.04 Jammy and x84_64 architecture, everything works as expected:

$ npm run start

> [email protected] start
> node -r @swc-node/register index.ts

x64 v20.16.0

Any ideas?

@webhype webhype changed the title Error: Bindings not found Error: Bindings not found on MacOS / NodeJS 20.16 for for ARM64 (M1/M2/M3 etc.) architecture Aug 17, 2024
@skriems
Copy link

skriems commented Nov 21, 2024

maybe you have to specify @swc/core directly in your package.json. The installation of @swc/core should pull the correct bindings for the platform you are invoking npm install on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants
@webhype @skriems and others