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

pkg stores absolute paths from the machine the executable was generated from #116

Closed
jviotti opened this issue May 30, 2017 · 1 comment
Closed

Comments

@jviotti
Copy link

jviotti commented May 30, 2017

Hey there! We're evaluating pkg for the Etcher (https://github.com/resin-io/etcher) CLI. I'm having some issues atm, and I'll create different tickets for your convenience, so here is the first one :)

I noticed that when packaging a program using pkg, the snapshot file-system contains absolute paths from the machine where the executable was generated from, even if I move the file to another directory, or to another computer, which is visible when a stack-trace is thrown, like you can see below:

/snapshot/Users/jviotti/Projects/resin/etcher/node_modules/bindings/bindings.js:88
  err = new Error('Could not locate the bindings file. Tried:\n'
        ^

Error: Could not locate the bindings file. Tried:
 → /snapshot/Users/jviotti/Projects/resin/etcher/node_modules/mountutils/build/MountUtils.node
 → /snapshot/Users/jviotti/Projects/resin/etcher/node_modules/mountutils/build/Debug/MountUtils.node
 → /snapshot/Users/jviotti/Projects/resin/etcher/node_modules/mountutils/build/Release/MountUtils.node
 → /snapshot/Users/jviotti/Projects/resin/etcher/node_modules/mountutils/out/Debug/MountUtils.node
 → /snapshot/Users/jviotti/Projects/resin/etcher/node_modules/mountutils/Debug/MountUtils.node
 → /snapshot/Users/jviotti/Projects/resin/etcher/node_modules/mountutils/out/Release/MountUtils.node
 → /snapshot/Users/jviotti/Projects/resin/etcher/node_modules/mountutils/Release/MountUtils.node
 → /snapshot/Users/jviotti/Projects/resin/etcher/node_modules/mountutils/build/default/MountUtils.node
 → /snapshot/Users/jviotti/Projects/resin/etcher/node_modules/mountutils/compiled/6.10.0/darwin/x64/MountUtils.node
    at bindings (/snapshot/Users/jviotti/Projects/resin/etcher/node_modules/bindings/bindings.js:88:9)
    at Object.<anonymous> (/snapshot/Users/jviotti/Projects/resin/etcher/node_modules/mountutils/index.js:52:37)
    at Module._compile (module.js:570:32)
    at Module._compile (evalmachine.<anonymous>:0)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at Module.require (evalmachine.<anonymous>:0)
    at require (internal/module.js:20:19)
    at Object.console./snapshot/Users/jviotti/Projects/resin/etcher/lib/cli/writer.js.dev (evalmachine.<anonymous>:0)
    at Module._compile (evalmachine.<anonymous>:0)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at Module.require (evalmachine.<anonymous>:0)
    at require (internal/module.js:20:19)
    at Object.console./snapshot/Users/jviotti/Projects/resin/etcher/lib/cli/etcher.js.dev (evalmachine.<anonymous>:0)
    at Module._compile (evalmachine.<anonymous>:0)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (evalmachine.<anonymous>:0)
    at run (bootstrap_node.js:398:7)
    at startup (bootstrap_node.js:153:9)
    at bootstrap_node.js:513:3

Is this behavior expected? Can pkg be configured to not store absolute paths from the machine the executable was generated from?

I'm not sure if pkg uses Browserify under the hood, or whether this is even relevant, but I encountered a similar bug in Browserify which I fixed on this PR: browserify/browserify#1725

@igorklopov
Copy link
Contributor

fixed by 4ea56b7

xdevs23 pushed a commit to xdevs23/pkg that referenced this issue Jul 26, 2017
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

2 participants