vercel / pkg

Package your Node.js project into an executable
https://npmjs.com/pkg
MIT License
24.3k stars 1.01k forks source link

Getting "argument must be one of type Buffer or Uint8Array. Received type object" error with Node 10, works ok with Node 8 #788

Closed alza-bitz closed 3 years ago

alza-bitz commented 4 years ago

Given Project: https://github.com/digital-dj-tools/mp3-parser pkg version: 4.3.8 pkg targets: node10-win-x64,node10-macos-x64,node10-linux-x64 (v10.4.1)

npm install
clojure -Acompile-cljs
npm run build
./pkg/mp3-parser-linux ../test-resources/lame-mp3-cbr-stereo-44100khz-192kbps-id3v2.mp3

Expected All the generated executables run ok (I can't test the Macos executable, I don't have a Mac).

Actual

TypeError [ERR_INVALID_ARG_TYPE]: The "buffer" argument must be one of type Buffer or Uint8Array. Received type object
   at Object.fs.readSync (fs.js:617:3)
   at Object.fs.readSync (pkg/prelude/bootstrap.js:555:32)
   at mp3_parser.app.parse (/snapshot/mp3-parser/out/cli.js:0:0)
   at mp3_parser.cli.process (/snapshot/mp3-parser/out/cli.js:0:0)
   at Function.mp3_parser.cli._main.cljs$core$IFn$_invoke$arity$variadic (/snapshot/mp3-parser/out/cli.js:0:0)         
   at Function.mp3_parser.cli._main.cljs$lang$applyTo (/snapshot/mp3-parser/out/cli.js:0:0)
   at Function.cljs.core.apply.cljs$core$IFn$_invoke$arity$2 (/snapshot/mp3-parser/out/cli.js:0:0)
   at cljs.core.apply (/snapshot/mp3-parser/out/cli.js:0:0)
   at Object.<anonymous> (/snapshot/mp3-parser/out/cli.js:0:0)
   at Module._compile (pkg/prelude/bootstrap.js:1259:22)"

However, if I change targets to node8-win-x64,node8-macos-x64,node8-linux-x64, the generated executables run ok.

Why do the generated executables give this error with Node 10, but it works ok with Node 8? I should add that if I use Node 10 directly on my system, I don't get the error:

node --version
v10.16.3
node ./out/cli.js ../test-resources/lame-mp3-cbr-stereo-44100khz-192kbps-id3v2.mp3
<generates correct output>
github-actions[bot] commented 3 years ago

This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label

github-actions[bot] commented 3 years ago

This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit.