nodejs / postject

Easily inject arbitrary read-only resources into executable formats (Mach-O, PE, ELF) and use it at runtime.
Other
187 stars 14 forks source link

Can't read and write to target executable #91

Closed Drjacky closed 9 months ago

Drjacky commented 11 months ago

I followed these steps to build a single executable application: https://nodejs.org/api/single-executable-applications.html but when I run

npx postject hello NODE_SEA_BLOB sea-prep.blob \
    --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \
    --macho-segment-name NODE_SEA 

I get

Start injection of NODE_SEA_BLOB in hello...
Error: Can't read and write to target executable

macOS node 21.4.0 npx 10.2.4

Drjacky commented 11 months ago

It is resolved by running it by sudo.

Now when I run file hello, it shows:

Mach-O 64-bit executable arm64

but I want to have a single executable for other platforms too.

tony-go commented 9 months ago

It is resolved by running it by sudo.

Happy you found a solution for this problem :) 🎉

but I want to have a single executable for other platforms too.

Postject is open source so feel free to take a look at the code 👍🏼