Native module next to binary file dont work [SOLVED]
Hi, i have the next error:
pkg/prelude/bootstrap.js:1178 throw error; ^
Error: Could not locate the bindings file. Tried: → /snapshot/4.0/node_modules/@serialport/bindings/build/bindings.node → /snapshot/4.0/node_modules/@serialport/bindings/build/Debug/bindings.node → /snapshot/4.0/node_modules/@serialport/bindings/build/Release/bindings.node → /snapshot/4.0/node_modules/@serialport/bindings/out/Debug/bindings.node → /snapshot/4.0/node_modules/@serialport/bindings/Debug/bindings.node → /snapshot/4.0/node_modules/@serialport/bindings/out/Release/bindings.node → /snapshot/4.0/node_modules/@serialport/bindings/Release/bindings.node → /snapshot/4.0/node_modules/@serialport/bindings/build/default/bindings.node → /snapshot/4.0/node_modules/@serialport/bindings/compiled/10.4.1/linux/arm/bindings.node → /snapshot/4.0/node_modules/@serialport/bindings/addon-build/release/install-root/bindings.node → /snapshot/4.0/node_modules/@serialport/bindings/addon-build/debug/install-root/bindings.node → /snapshot/4.0/node_modules/@serialport/bindings/addon-build/default/install-root/bindings.node → /snapshot/4.0/node_modules/@serialport/bindings/lib/binding/node-v64-linux-arm/bindings.node at bindings (/snapshot/4.0/node_modules/bindings/bindings.js:124:9) at Object.
(/snapshot/4.0/node_modules/@serialport/bindings/lib/linux.js:1:98) at Module._compile (pkg/prelude/bootstrap.js:1254:22) at Object.Module._extensions..js (internal/modules/cjs/loader.js:711:10) at Module.load (internal/modules/cjs/loader.js:610:32) at tryModuleLoad (internal/modules/cjs/loader.js:549:12) at Function.Module._load (internal/modules/cjs/loader.js:541:3) at Module.require (internal/modules/cjs/loader.js:648:17) at Module.require (pkg/prelude/bootstrap.js:1159:31) at require (internal/modules/cjs/helpers.js:20:18)
I tried to copy bindings.node next to binary file, but the issue persist.
any idea? i'm using node10 and raspbian, armv7
Is it planned to add support for native modules in the future?
To solve this error, i edited (before pkg):
node_modules/bindings/bindings.js
Added to this file, the absolute path for bindings.node and delete the other routes. It's just a patch but works for my needs.
First, sorry for my English, I solved this issue in the following way:
Edit /node_modules/bindings/bindings.js.
At line 23, there is a try followed by arrarys, example:
try: [
node-gyp's linked version in the "build" dir
['module_root', 'build', 'bindings'],
node-waf and gyp_addon (a.k.a node-gyp)
['module_root', 'build', 'Debug', 'bindings'],
['module_root', 'build', 'Release', 'bindings'],
Debug files, for development (legacy behavior, remove for node v0.9)
['module_root', 'out', 'Debug', 'bindings'],
['module_root', 'Debug', 'bindings'],
Release files, but manually compiled (legacy behavior, remove for node v0.9)
['module_root', 'out', 'Release', 'bindings'],
['module_root', 'Release', 'bindings'],
Legacy from node-waf, node <= 0.4.x
['module_root', 'build', 'default', 'bindings'],
Production "Release" buildtype binary (meh...)
['module_root', 'compiled', 'version', 'platform', 'arch', 'bindings'],
node-qbs builds
['module_root', 'addon-build', 'release', 'install-root', 'bindings'],
['module_root', 'addon-build', 'debug', 'install-root', 'bindings'],
['module_root', 'addon-build', 'default', 'install-root', 'bindings'],
node-pre-gyp path ./lib/binding/{node_abi}-{platform}-{arch}
['module_root', 'lib', 'binding', 'nodePreGyp', 'bindings']
]
I deleted all routes(arrays) and write the absolute path to my project:
try: [ ['/home','pi','my_project','bindings']]
Put the binding.node file in the path you indicate to try.
That's it!
the same issue.
To fix this issue, I simply added the native modules that I need in the assets of my pkg like so (in my package.json): "assets": "node_modules/@saleae/**"
To fix this issue, I simply added the native modules that I need in the assets of my pkg like so (in my package.json): "assets": "node_modules/@saleae/**"
Does not work
worked for @serialport and usb module!
"pkg": {
"scripts": "dist/**/*.js",
"assets": [
"scripts/ * */ *",
"node_modules/@serialport/ * */ *",
"node_modules/usb/ * */ *"
],
"targets": [
"node10.24.1-linux-x64",
"node10.24.1-win-x64"
],
"outputPath": "build"
}
in patchs remove extra space