node-ffi-napi / ref-napi

Turn Buffer instances into "pointers"
MIT License
126 stars 68 forks source link

Apple M1 #51

Open rubyte-s opened 3 years ago

rubyte-s commented 3 years ago

Error: No native build was found for platform=darwin arch=arm64 runtime=electron abi=85 uv=1 armv=8 libc=glibc node=12.18.3 electron=11.0.3 loaded from: /Users/shaun/.vscode-exploration/extensions/intersystems.language-server-1.0.5/server/node_modules/ref-napi

at Function.load.path (/Users/shaun/.vscode-exploration/extensions/intersystems.language-server-1.0.5/server/node_modules/node-gyp-build/index.js:59:9)
at load (/Users/shaun/.vscode-exploration/extensions/intersystems.language-server-1.0.5/server/node_modules/node-gyp-build/index.js:21:30)
at Object.<anonymous> (/Users/shaun/.vscode-exploration/extensions/intersystems.language-server-1.0.5/server/node_modules/ref-napi/lib/ref.js:8:53)
at Module._compile (internal/modules/cjs/loader.js:1152:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1173:10)
at Module.load (internal/modules/cjs/loader.js:992:32)
at Module._load (internal/modules/cjs/loader.js:885:14)
at Function.f._load (electron/js2c/asar_bundle.js:5:12694)
at Module.require (internal/modules/cjs/loader.js:1032:19)
at require (internal/modules/cjs/helpers.js:72:18)
detongz commented 3 years ago

+1

cunchi commented 3 years ago

How is the progress of this issue🤔️

ayush2209 commented 3 years ago

Did you got any solution for this issue. I am alos facing this issue on M1 Mac.

TimothyJones commented 3 years ago

How are you triggering this issue? I'm on an M1, and on npm install node-gyp-build triggers and compiles from source happily.

msynk commented 3 years ago

How are you triggering this issue? I'm on an M1, and on npm install node-gyp-build triggers and compiles from source happily.

the error will be raised at runtime and not at the build/compile time.

TimothyJones commented 3 years ago

How are you triggering the error? I am on M1 and have no trouble using this package.

The build triggers on install, which is where your error is coming from.

amccloud commented 2 years ago

I'm also seeing the same error at runtime on a M1. Install/build works fine and the error happens only during runtime when ffi-napi is imported. If I force my process to run under Rosetta everything works as expected. cc: @msynk

@TimothyJones I'm not entirely sure how the prebuild system works, but it looks like arm64 for darwin does not exist for ref-napi@3.0.3. Should i expect it to build on my mahcine?

ls -la node_modules/ref-napi/prebuilds/ 
total 0
drwxr-xr-x   7 andrew  staff  224 Dec 11 10:16 .
drwxr-xr-x  19 andrew  staff  608 Dec 11 10:16 ..
drwxr-xr-x   4 andrew  staff  128 Dec 11 10:16 darwin-x64
drwxr-xr-x   4 andrew  staff  128 Dec 11 10:16 linux-arm64
drwxr-xr-x   4 andrew  staff  128 Dec 11 10:16 linux-x64
drwxr-xr-x   4 andrew  staff  128 Dec 11 10:16 win32-ia32
drwxr-xr-x   4 andrew  staff  128 Dec 11 10:16 win32-x64  
Error: No native build was found for platform=darwin arch=arm64 runtime=electron abi=85 uv=1 armv=8 libc=glibc node=12.18.3 electron=11.5.0
    loaded from: /Applications/Example.app/Contents/Resources/app-arm64.asar/node_modules/ref-napi
amccloud commented 2 years ago

It looks like installing packages with npm_config_build_from_source=true in the environment seems to bypass prebuilds and works for me

TC-mSundaram commented 2 years ago

I'm seeing this same issue, but npm_config_build_from_source=true npm install doesn't resolve it. Is there anything else that I could try?

TC-mSundaram commented 2 years ago

This is what I'm getting at runtime:

Uncaught Exception:
Error: dlopen(/Volumes/ElectronApp-arm64/ElectronApp.app/Contents/Resources/app.asar.unpacked/node_modules/ref-napi/build/Release/binding.node, 0x0001): tried: '/Volumes/ElectronApp-arm64/ElectronApp.app/Contents/Resources/app.asar.unpacked/node_modules/ref-napi/build/Release/binding.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/binding.node' (no such file), '/usr/lib/binding.node' (no such file)
at process.func [as dlopen] (node:electron/js2c/asar_bundle:5:1800)
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1199:18)
at Object.func [as .node] (node:electron/js2c/asar_bundle:5:2027)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Module._load (node:internal/modules/cjs/loader:829:12)
at Function.c._load (node:electron/js2c/asar_bundle:5:13331)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:9418)
at load (/Volumes/ElectronApp-arm64/ElectronApp.app/Contents/Resources/app.asar/node_modules/node-gyp-build/index.js:21:10)
at Object.<anonymous> (/Volumes/
TC-mSundaram commented 2 years ago

Update: I was able to resolve the issue. I am using electron-builder and needed to use buildDependenciesFromSource in the config.

kabaehr commented 2 years ago

Maybe this helps someone, not sure. I only had this with Node < version 17. With version 17 I have other issues I am looking into right now, though

cuijindong commented 1 year ago

How is the progress of this issue