Skip to content

Created linux binary no longer works on WSL 1 #175

@kayahr

Description

@kayahr

What version of pkg are you using?

6.7.0

Which version(s) of pkg work for you?

6.6.0

What version of Node.js are you using?

22.20.0

What operating system are you using?

Debian 13

What CPU architecture are you using?

x86_64

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

node22-linux-x64

Describe the Bug

Linux binaries created with pkg 6.7.0 are no longer executable on Windows with WSL 1 (distro doesn't matter, tried Ubuntu 22 and 24):

cannot execute binary file: Exec format error

It works fine on a real Linux and on WSL 2 (same distro as used on WSL 1).

Downgrading to pkg 6.6.0 fixes the problem.

My first thought was that this is because of the updated Node.js (pkg v6.6.0 uses Node.js 22.17, pkg v6.7.0 uses Node.js 22.19) but I can download the linux version of Node.js 22.19 in WSL 1 and execute it. No errors.

Expected Behavior

Expected behavior is that the executable is working the same as on WSL 2 and a real Linux.

To Reproduce

  • Write some JS file and package it with v6.7.0:

    pkg test.js -t node22-linux-x64
    
  • Copy the binary to a WSL 1 installation on Windows 10 and execute it:

    $ ./test
    -bash: ./test: cannot execute binary file: Exec format error
    
  • When pkg is called in WSL 1 to create the binary then it also outputs a warning:

    > Warning Failed to make bytecode node22-x64 for file /snapshot/test/test.js
    
  • Downgrade pkg to v6.6.0 and try again. No problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions