Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

SyntaxError: Invalid or unexpected token in pkg/prelude/bootstrap.js #321

Closed
dhruvio opened this issue Jan 8, 2018 · 8 comments
Closed

Comments

@dhruvio
Copy link

dhruvio commented Jan 8, 2018

I receive this error when using the Now CLI (version 9.0.1). I'm using Node.js 8.9.3, and am on NixOS. Note that I patch the Now CLI binary to use my own dynamic linker, and update its RPATH to point to libstdc++.so.6 (not found on my system by default).

pkg/prelude/bootstrap.js:1



SyntaxError: Invalid or unexpected token
    at readPrelude (bootstrap_node.js:133:17)
    at bootstrap_node.js:140:22
    at bootstrap_node.js:147:8
    at startup (bootstrap_node.js:148:6)
    at bootstrap_node.js:649:3
@dhruvio
Copy link
Author

dhruvio commented Jan 11, 2018

Bump :)

@AHgPuK
Copy link

AHgPuK commented Jan 22, 2018

It happens to me as well when I try to replace an default icon to my own using ResourceHacker under Windows

@ashking
Copy link

ashking commented Feb 3, 2018

Yup, any solution to this?

@kennethpdev
Copy link

yup same happened to me lol

@EDais
Copy link

EDais commented May 11, 2018

Just ran into the same issue in a local build script. Circumvented for now by generating a new .ico file with exactly the same icon sizes as the original file (16, 32, 48, 64, 128 @ 32-bpp.) This keeps the file sizes the same and presumably any resource offsets etc which may have been causing issues when writing the new executable.

@patroclos
Copy link

@dhruvio I figured the syntax errors might be related to string offset changes from patching the binary. (I also run NixOS)
So I set the LD_LIBRARY_PATH instead and invoked the interpreter directly
env LD_LIBRARY_PATH=/nix/store/....-gcc-7.3.0-lib/lib64 /nix/store/....-glibc-2.26-131/lib/ld-linux-x86_64.so.2 ./upm-linux (upm-linux being the pkg'd binary)

Now I get 'Pkg: Error reading from file.' as output.
I did a bit of digging around in the loader code, and the process.execPath that is opened in order to read the code (which should be the binary that is running) is set to the path of ld-2.26.so

The quick and dirty solution that worked was to create a /lib64 directory and symlink the ld-linux-x86-64.so.2 from glibc into there.

I'd be interested to know, after using patchelf to modify the interpreter and/or rpath, what parts of the file would need changing to work with the new offsets

@dhruvio
Copy link
Author

dhruvio commented Nov 30, 2018

@dhruvio
Copy link
Author

dhruvio commented Apr 12, 2019

nixpkgs has the now CLI in its package library.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants