Skip to content

Failed to load native bindings on linux x64 platform #431

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
ckifer opened this issue Apr 17, 2025 · 6 comments
Closed

Failed to load native bindings on linux x64 platform #431

ckifer opened this issue Apr 17, 2025 · 6 comments

Comments

@ckifer
Copy link

ckifer commented Apr 17, 2025

Creating this issue from #405

also facing this issue with the same error on Amazon Linux 2

Error is

Oops! Something went wrong! :(
ESLint: 9.16.0
Error: Failed to load native binding
Occurred while linting /local/p4clients/pkgbuild-const/workspace/src/<redacted>/test/client.test.ts:1
Rule: "import/namespace"
    at Object.<anonymous> (/local/p4clients/pkgbuild-const/workspace/src//<redacted>/node_modules/unrs-resolver/index.js:372:11)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/local/p4clients/pkgbuild-const/<redacted>/src/<redacted>/node_modules/eslint-import-resolver-typescript/lib/index.cjs:12:20)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10) 

Originally posted by @ckifer in #405

Info:

process.platform is linux, x64, isMusl is false

nativeBinding is always undefined, loaderErrors are:

 Error: Cannot find module './resolver.linux-x64-gnu.node'
 Error: Cannot find module '@unrs/resolver-binding-linux-x64-gnu'

I set NAPI_RS_FORCE_WASI to true and then:

Error: Cannot find module '@unrs/resolver-binding-wasm32-wasi'
Error: Cannot find module './resolver.wasi.cjs'

Installing @unrs/resolver-binding-linux-x64-gnu fixes the issue but then makes builds on MacOS fail.

Attempted to upgrade npm to 10.x and this still failed. Cannot upgrade npm further or use different package managers due to company restrictions

@JounQin
Copy link
Collaborator

JounQin commented Apr 17, 2025

Can you provide a reproduction? And provide unrs-resolver version info?

@ckifer
Copy link
Author

ckifer commented Apr 17, 2025

unrs-resolver version info

The repro will take me a while probably

@JounQin
Copy link
Collaborator

JounQin commented Apr 17, 2025

In the meantime, you can use NAPI_RS_FORCE_WASI=true and install @unrs/resolver-binding-wasm32-wasi manually.

@ckifer
Copy link
Author

ckifer commented Apr 17, 2025

Sounds good thanks. I'll work on the repro tonight or tomorrow my time

Appreciate your help and responsiveness!

@ckifer
Copy link
Author

ckifer commented Apr 17, 2025

@JounQin I figured it out while making the reproduction. With vanilla npm all is fine. My company has an internal artifactory for npm which hosts specific versions of packages. there is a delay of packages to scan for vulnerabilities, etc.

1.5.0 of unrs-resolver exists in the npm mirror, but 1.5.0 of all of the binding packages do not. I'm not sure how I missed this when I installed '@unrs/resolver-binding-linux-x64-gnu the first time here because that worked, it must've been a cache issue or lockfile issue.

'@unrs/resolver-binding-linux-x64-gnu@*' is not in this registry.

So for anyone who finds this in the future, make sure to check that all packages are actually available in your npm registry. If they are not, they will not auto-install and this will fail semi-silently.

Closing this as resolved, this case everything was on my side. Might be nice to add a debug flag to unrs-resolver to auto-print useful information out of the package for people in the future!

Thanks again 🙏🏼

@ckifer ckifer closed this as completed Apr 17, 2025
@JounQin
Copy link
Collaborator

JounQin commented Apr 17, 2025

Might be nice to add a debug flag to unrs-resolver to auto-print useful information out of the package for people in the future!

Indeed!

@JounQin JounQin pinned this issue Apr 17, 2025
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

2 participants