Skip to content

The module 'addon' was compiled against a different Node.js ABI version #17711

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

Closed
cesco69 opened this issue Feb 26, 2025 · 1 comment
Closed
Labels
bug Something isn't working needs triage

Comments

@cesco69
Copy link

cesco69 commented Feb 26, 2025

What version of Bun is running?

1.2.2+c1708ea6a

What platform is your computer?

Windows 11 x64

What steps can reproduce the bug?

Hi, I want use "pg-native" module in a Bun project, eg:

package.json

{
  "name": "test",
  "module": "index.ts",
  "type": "module",
  "devDependencies": {
    "@types/bun": "latest"
  },
  "peerDependencies": {
    "typescript": "^5.0.0"
  },
  "dependencies": {
    "pg-native": "^3.2.2"
  }
}

index.ts

import { Client } from 'pg-native'

const client = new Client();
client.connect(function(err) {
  if(err) throw err
  client.query('SELECT NOW() AS the_date', function(err, rows) {
    if(err) throw err
    console.log(rows[0].the_date) //Tue Sep 16 2014 23:42:39 GMT-0400 (EDT)
  })
})

when run

bun run index.ts

Bun show this error:

107 |         return opts[p] || p;
108 |       })
109 |     );
110 |     tries.push(n);
111 |     try {
112 |       b = opts.path ? requireFunc.resolve(n) : requireFunc(n);
                                                     ^
error: The module 'addon' was compiled against a different Node.js ABI version using NODE_MODULE_VERSION 131. This version of Bun requires NODE_MODULE_VERSION 127. Please try re-compiling or re-installing the module.
      at bindings (D:\test-bun\node_modules\bindings\bindings.js:112:48)
      at <anonymous> (D:\test-bun\node_modules\libpq\index.js:1:18)
      at <anonymous> (D:\test-bun\node_modules\pg-native\index.js:1:5)

Additional information

maybe correlate to #4290

@cesco69 cesco69 added bug Something isn't working needs triage labels Feb 26, 2025
@190n
Copy link
Collaborator

190n commented Feb 26, 2025

The direct cause of this issue is that some part of the package manager doesn't pass through our NODE_MODULE_VERSION, so pg-native is getting built or downloaded for a different Node.js version than the one Bun's V8 C++ API implementation targets. We should fix that, but fixing that won't make pg-native work because it uses several V8 APIs that Bun doesn't implement. You can track our progress on V8 APIs in #4290.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

2 participants