igorklopov / enclose

Compile your Node.js project into an executable
http://enclosejs.com
Other
936 stars 43 forks source link

Failure to include native add-ons #95

Closed jviotti closed 7 years ago

jviotti commented 8 years ago

Hey there,

We're experimenting with the Enclose trial to distribute the CLI version of https://github.com/resin-io/etcher, but we're getting the following issue on OS X when executing the resulting package:

Error: Cannot find module '/thebox/Users/jviotti/Projects/resin/etcher/node_modules/lzma-native/binding/lzma_native.node'
1) If you want to enclose the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to enclose the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.argv[1].
    at Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at e:0
    at Object.console./thebox/Users/jviotti/Projects/resin/etcher/node_modules/lzma-native/index.js.dev (e:0)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.console./thebox/Users/jviotti/Projects/resin/etcher/node_modules/etcher-image-stream/lib/handlers.js.dev (e:0)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.console./thebox/Users/jviotti/Projects/resin/etcher/node_modules/etcher-image-stream/lib/index.js.dev (e:0)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.console./thebox/Users/jviotti/Projects/resin/etcher/lib/cli/writer.js.dev (e:0)
    at Object.Module._extensions..js (module.js:416:10)

You can reproduce with the following steps:

$ git clone https://github.com/resin-io/etcher
$ cd etcher

# --force is required since EncloseJS will complain about some
# optional dependencies necessary for other OSes.
$ npm install --force --build-from-source 

$ enclose -o etcher ./bin/etcher

Is enclose omitting .node files?

igorklopov commented 8 years ago

Let me check...

igorklopov commented 8 years ago

Hi Juan. Sorry for so long. But i made necessary adjustments to enclose (2.1.0 just released) and to your etcher code: https://github.com/resin-io/etcher/pull/454 Please install etcher with my modification and compile it with 2.1.0. You can also type just npm install instead of npm install --force --build-from-source

jviotti commented 8 years ago

Hi @igorklopov ,

Thanks a lot of the answer. I've merged the commit and upgraded EncloseJS to v2.1.0 but I'm still encountering the same problem (on OS X):

$ ./etcher
*** Evaluation version. Please subscribe to full version.
module.js:440
    var err = new Error("Cannot find module '" + request + "'");
              ^

Error: Cannot find module '/thebox/Users/jviotti/Projects/resin/etcher/node_modules/lzma-native/binding/lzma_native.node'
1) If you want to enclose the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to enclose the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.argv[1].
    at Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at /thebox/Users/jviotti/Projects/resin/etcher/node_modules/lzma-native/index.js:14:14
    at Object.<anonymous> (/thebox/Users/jviotti/Projects/resin/etcher/node_modules/lzma-native/index.js:604:3)
    at Module._compile (module.js:541:32)
    at Object.M

$ enclose -v
enclose@2.1.0
igorklopov commented 7 years ago

Dear users of EncloseJS! I highly encourage you to switch to https://github.com/zeit/pkg It is rewritten successor of EncloseJS. It is open source, and all improvements will go there. Please check if pkg has your issue unresolved, and if it is true, reopen your issue there: https://github.com/zeit/pkg/issues