Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

470
Views
Error: No native build was found for platform when using node pkg with serialport

I am using the node pkg package to package up my node app and create a native executable. But for some reason when I use the serialport npm package in my app, it compiles but when I try to run it it throws this error (no matter what platform I build for):

$ ./app

pkg/prelude/bootstrap.js:1876
      throw error;
      ^

Error: No native build was found for platform=linux arch=x64 runtime=node abi=83 uv=1 libc=glibc node=14.19.2
    loaded from: /snapshot/pkg/node_modules/@serialport/bindings-cpp

    at Function.path (/snapshot/pkg/node_modules/node-gyp-build/index.js:60:9)
    at load (/snapshot/pkg/node_modules/node-gyp-build/index.js:22:30)
    at Object.<anonymous> (/snapshot/pkg/node_modules/@serialport/bindings-cpp/dist/load-bindings.js:10:46)
    at Module._compile (pkg/prelude/bootstrap.js:1930:22)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at Module.require (pkg/prelude/bootstrap.js:1855:31)
    at require (internal/modules/cjs/helpers.js:101:18)

Here is my package.json

{
  "name": "pkg",
  "version": "1.0.0",
  "dependencies": {
    "serialport": "^10.4.0"
  }
}

And here is my app.js

const { SerialPort } = require('serialport')

const port = new SerialPort({
  path: '/dev/ttyUSB0',
  baudRate: 19200,
})

console.log('Serial port opened successfully!')

And this is how I build:

$ pkg app.js --target=node14-linux-x64
> pkg@5.7.0
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!