pkg: Error: No native build was found for platform
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:
pkg/prelude/bootstrap.js:1872
throw error;
^
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
loaded from: /snapshot/my-project/node_modules/@serialport/bindings-cpp
at Function.<anonymous> (/snapshot/my-project/node_modules/node-gyp-build/node-gyp-build.js:60:9)
at load (/snapshot/my-project/node_modules/node-gyp-build/node-gyp-build.js:22:30)
at Object.<anonymous> (/snapshot/my-project/node_modules/@serialport/bindings-cpp/dist/load-bindings.js:11:46)
at Module._compile (pkg/prelude/bootstrap.js:1930:22)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at Module.require (pkg/prelude/bootstrap.js:1851:31)
at require (node:internal/modules/cjs/helpers:119:18)
Node.js v18.18.2
I also get the following warning during compilation (when running npm run package):
> pkg@5.10.0
prebuild-install warn install No prebuilt binaries found (target=18.18.2 runtime=node arch=armv7 libc= platform=undefined)
prebuild-install warn install No prebuilt binaries found (target=18.18.2 runtime=node arch=armv7 libc= platform=undefined)
prebuild-install warn install No prebuilt binaries found (target=18.18.2 runtime=node arch=armv7 libc= platform=undefined)
prebuild-install warn install No prebuilt binaries found (target=18.18.2 runtime=node arch=armv7 libc= platform=undefined)
prebuild-install warn install No prebuilt binaries found (target=18.18.2 runtime=node arch=armv7 libc= platform=undefined)
prebuild-install warn install No prebuilt binaries found (target=18.18.2 runtime=node arch=armv7 libc= platform=undefined)
prebuild-install warn install No prebuilt binaries found (target=18.18.2 runtime=node arch=armv7 libc= platform=undefined)
prebuild-install warn install No prebuilt binaries found (target=18.18.2 runtime=node arch=armv7 libc= platform=undefined)
prebuild-install warn install No prebuilt binaries found (target=18.18.2 runtime=node arch=armv7 libc= platform=undefined)
prebuild-install warn install No prebuilt binaries found (target=18.18.2 runtime=node arch=armv7 libc= platform=undefined)
prebuild-install warn install No prebuilt binaries found (target=v18.18.2 runtime=node arch=armv7 libc= platform=undefined)
I have the following package.json:
{
"name": "my-project",
"version": "0.0.1",
"description": "",
"bin": "dist/src/main.js",
"scripts": {
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"package": "npm run build && mkdir -p bin && npx pkg ."
},
"dependencies": {
"@nestjs/common": "^10.0.0",
"@nestjs/config": "^3.2.2",
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
...
"serialport": "^10.5.0",
},
"devDependencies": {
"@nestjs/cli": "^10.0.0",
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.3.8",
...
},
"pkg": {
"scripts": "dist/**/*.js",
"targets": [
"node18-linuxstatic-armv7"
],
"assets": [
"./node_modules/@serialport/bindings-cpp/**"
],
"outputPath": "bin"
}
}
What I’ve already tried:
- Downgrading serialport. Tried the latest (v12.0.0) as well as older versions (v10.5.0)
- Tried adding the following under pkg “assets” (#61, #1903, #1660):
- “./node_modules/@serialport/bindings-cpp/**”
- “./node_modules/@serialport/bindings-cpp/prebuilds”,
- “./node_modules/@serialport/**/*”
- I also tried copying the prebuilds directory to the same directory as the output ‘bin/’ #1660
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
- Serialport v12.0.0
- pkg v5.10.0
- node v18.18.2
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 18 (7 by maintainers)
@robertsLando Thank you for your help. I’ve got it running for my original project 🥳