question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Warning Failed to make bytecode for file

See original GitHub issue

Trying to package an app with just --targets node8.6.0-win-x86 in linux. Get dozens of warnings: Warning Failed to make bytecode for file C:\snapshot\app\index.js error (spawn /home/travis/.pkg-cache/v2.3/fetched-v8.6.0-linux-x86 ENOENT).

The resulting app doesn’t work on Windows.

If i enable --no-bytecode, I get:

Error! --no-bytecode and no source breaks final executable /home/travis/build/app/index.js Please run with “-d” and without “–no-bytecode” first, and make sure that debug log does not contain “was included as bytecode”.

With the option disabled and -d enabled I get around one hundred lines with [debug] The file was included as bytecode (no sources) in the logs.

If I launch the same packaging process in macOS, it works fine.

Both pkg@4.2.6 or pkg@4.3.0-beta.5.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:19

github_iconTop GitHub Comments

13reactions
huerlisicommented, Feb 4, 2018

I experienced the same issue on GitLab CI. But I was able to build them locally. The solution was to include support for 32-bit executables.

I’m using the node:7 image on GitLab CI as build image. The runners are on a 64-bit host. When debugging locally using docker run -it -v $PWD:/root/vdds-client node:7 /bin/bash I found out that I had the same issue as on the CI: no proper win-x86 output.

Using the -d flag for pkg I saw the following section:

> [debug] Targets:
  [
  {
    "nodeRange": "node6",
    "platform": "win",
    "arch": "x86",
    "output": "/root/vdds-client/client.exe",
    "forceBuild": false,
    "fabricator": {
      "nodeRange": "node6",
      "platform": "linux",
      "arch": "x86",
      "forceBuild": false,
      "binaryPath": "/root/.pkg-cache/v2.5/fetched-v6.11.5-linux-x86"
    },
    "binaryPath": "/root/.pkg-cache/v2.5/fetched-v6.11.5-win-x86"
  }
]

When trying to run the /root/.pkg-cache/v2.5/fetched-v6.11.5-linux-x86 it gave me the following error:

root@a2cd31593bb2:~/vdds-client# ls /root/.pkg-cache/v2.5/fetched-v6.11.5-linux-x86
/root/.pkg-cache/v2.5/fetched-v6.11.5-linux-x86
root@a2cd31593bb2:~/vdds-client# /root/.pkg-cache/v2.5/fetched-v6.11.5-linux-x86
bash: /root/.pkg-cache/v2.5/fetched-v6.11.5-linux-x86: No such file or directory

So I took a look:

root@a2cd31593bb2:~/vdds-client# file /root/.pkg-cache/v2.5/fetched-v6.11.5-linux-x86
/root/.pkg-cache/v2.5/fetched-v6.11.5-linux-x86: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.18, BuildID[sha1]=ac11506dd30ec242b56788701d1315efeed93910, not stripped

This triggered the idea that I did include the i386 support locally…

So I was able to fix it for my case (gitlab-ci, node:7 image) by installing glibc with i386 support by adding the following to the .gitlab-ci.yml script section:

    - dpkg --add-architecture i386
    - apt-get update
    - apt-get install -y libc6:i386 libstdc++6:i386

You might need to adapt for your setup;-) Installing ia32-libs instead of multiarch could be also a way, don’t know about non-Debian systems…

4reactions
adonespitogocommented, Dec 27, 2017

@zeit If you can let us know where to start looking into this issue, I’d be very much happy to help fix this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Warning Failed to make bytecode #641 - vercel/pkg - GitHub
Got this error when run with --debug flag.brotli npm package is using emscripten c++ compiler to compile c++ code to javascript directly.the ...
Read more >
PKG Failed to make Bytecode - Stack Overflow
I am getting this warning when I try and run .. pkg index.js -t macOS ... Warning Failed to make bytecode node17-arm64 for...
Read more >
Pkg - Best of JS
Specifying --no-bytecode will fail if there are any packages in your project that aren't explicitly marked as public by the license in their...
Read more >
Developers - Warning Failed to make bytecode - - Bountysource
Getting a warning while creating executeable. Warning Failed to make bytecode node8-x64 for file /snapshot/node_modules/brotli/build/encode.
Read more >
Package Your Node.js Project Into An Executable - Morioh
Specifying --no-bytecode will fail if there are any packages in your project that aren't explicitly marked as public by the license in their...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found