vercel / pkg

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

notice pkg has a serious bug when we use child_process exec exec,execFile spawn #2025

Closed introspection3 closed 8 months ago

introspection3 commented 9 months ago

What version of pkg are you using?

5.8.1

What version of Node.js are you using?

18.5

What operating system are you using?

windows ,maybe linux too

What CPU architecture are you using?

x64

What Node versions, OSs and CPU architectures are you building for?

node18-win32-x64

Describe the Bug

if you create a binary with pkg, this binary can't be called with " child_process exec exec,execFile spawn" code.zip

there is something wrong with pkg binary

Expected Behavior

as above

To Reproduce

use our code

introspection3 commented 9 months ago

pkg/prelude/bootstrap.js:1945 if (error.code !== 'MODULE_NOT_FOUND') throw error; ^

TypeError: String.prototype.startsWith called on null or undefined at startsWith () at Module._resolveFilename (node:internal/modules/cjs/loader:861:7) at Function._resolveFilename (pkg/prelude/bootstrap.js:1943:44) at Module._load (node:internal/modules/cjs/loader:787:27) at Function.runMain (pkg/prelude/bootstrap.js:1979:12) at node:internal/main/run_main_module:17:47

Node.js v18.5.0