vercel / pkg

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

SyntaxError: Invalid or unexpected token #2037

Closed Drjacky closed 8 months ago

Drjacky commented 8 months ago

What version of pkg are you using?

5.8.1

What version of Node.js are you using?

21.4.0

What operating system are you using?

macOS

What CPU architecture are you using?

Apple M2

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

node21-mac-arm64

Describe the Bug

I have put the single executable app in my intellij plugin > resources and run it by:

val processBuilder = ProcessBuilder("node", executableFile.absolutePath, "-i", fullPath)
val process = processBuilder.start()

but got:

Error Stream: /Users/usernameee/Projectz/Example/build/idea-sandbox/plugins/Example/lib/instrumented-Example-1.0.1.jar:1
PK
  ^

SyntaxError: Invalid or unexpected token
    at internalCompileFunction (node:internal/vm:77:18)
    at wrapSafe (node:internal/modules/cjs/loader:1288:20)
    at Module._compile (node:internal/modules/cjs/loader:1340:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49

Expected Behavior

Run the single executable node application with this java code: ProcessBuilder("node", executableFile.absolutePath, "-i", fullPath)

To Reproduce

N/A

Drjacky commented 8 months ago

I built that ☝🏼 executable by following: https://nodejs.org/api/single-executable-applications.html; The one built by pkg works correctly.