-
-
Notifications
You must be signed in to change notification settings - Fork 29
Error: No native build was found for platform #66
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
Comments
@chandirag did you ever resolve this issue? We are facing the same problem with pkg: 6.3.2 We try to build for a Raspberry Pi 4 Model B Rev 1.5 with BCM2835. When removing the serialport dependency, we can run both node22-linuxstatic-arm64 and node22-linuxstatic-armv7. My understanding is, that we have a 32bit armv7 chip, nevertheless both executable work. After adding the dependency they both fail with different errors. node22-linuxstatic-arm64
node22-linuxstatic-armv7
When I add
Any ideas on how to solve this issue? |
Totally forgot to mention. We also build a Windows version, which works like a charm. What also works is copying the Therefore I assume it is either an issue with the pre-built node executable, or with the selection of the correct pre-built version of serialport. This is an extract of our package.json
|
Please share pkg command output with Does this happens also with older pkg versions? |
Thanks a lot for your feedback @robertsLando I just checked with pkg 5.16.1 instead of 6.3.2, the result is the same. Let me know, if I should check with a specific other version, or different node version. Log of pkg command with --debug Log of start of node22_linuxstatic_armv7 executable with DEBUG_PKG=2 |
@DaniRey The most useful are the logs when you start the application as them show all the reads that are done on filesystem the problem is that the last line I see there are:
did you trimmed the output or the logs stop there? In this cases what I do in order to understand the issue is to put some logs in module files that cause the issue like: /node_modules/@serialport/bindings-cpp/dist/load-bindings.js:11:46 Try to check if they are loading a wrong path, put some console logs then trigger a new pkg build and execute it to see if you understand what's wrong. If needed then pkg supports patching of files (I already do this to support some modules like node pino). Example: "pkg": {
"scripts": [
<....>
],
"assets": [
<...>
],
"patches": {
"./node_modules/thread-stream/lib/worker.js": [
"worker = (await realImport(filename))",
"worker = realRequire(decodeURIComponent(filename.replace(process.platform === 'win32' ? 'file:///' : 'file://', '')))"
],
"./node_modules/pino/lib/transport-stream.js": [
"fn = (await realImport(toLoad))",
"fn = realRequire(target)"
],
"./node_modules/fontkit/dist/main.cjs": [
"new TextDecoder('ascii');",
"new TextDecoder('utf-8');"
]
} |
@robertsLando that's the full log, I started the application from the desktop. The trick with patching should get us going. I'll use it to add some additional logging and then hopefully to patch require the way we need it. I too suspect that this is where the problem lays. I'll try it after the holidays. Thank you for the support. |
@DaniRey I suggest to reproduce this with a very small script first to speed up testing. Please share your findings then, I have a feel serialport changed something in how it loads binaries that broke pkg lookup. I could take a look at this maybe next week but cannot promise anything |
Ok, we're making progress. Here is a minimal project setup https://github.com/DaniRey/pkg_serialport_friendship The reason the native serialport module is not found, is that "armv" is set to "default" in node22_linuxstatic_armv7. When I modify node_modules/node-gyp-build/node-gyp-build.js and add the following line (plus some logging).
the lookup works, but unfortunately I then get ERR_DLOPEN_FAILED. By the way, the whole setup still works as expected on windows.
The fully modified version of node_modules/node-gyp-build/node-gyp-build.js is as follows
|
This might be related to astefanutti/scratch-node#3 |
What version of pkg are you using?
5.10.0
What version of Node.js are you using?
18.18.2
What operating system are you using?
Ubuntu 22.04.4 LTS
What CPU architecture are you using?
x86_64
What Node versions, OSs and CPU architectures are you building for?
node18-linuxstatic-armv7
Describe the Bug
My project uses the node-serialport library. I am getting the following error when trying to run the compiled binary:
I also get the following warning during compilation (when running
npm run package
):I have the following package.json:
What I've already tried:
I still keep getting the above error. Any help is appreciated.
Expected Behavior
Compiled binary to execute without throwing
Error: No native build was found for platform=linux arch=arm runtime=node abi=108 uv=1 armv=default libc=glibc node=18.18.2
To Reproduce
Compiling any new node project which utilizes the serial port library
The text was updated successfully, but these errors were encountered: