Sharp with EncloseJS - #124

jenkinsDynosense opened this Issue Oct 18, 2016 · 0 comments


None yet

1 participant

jenkinsDynosense commented Oct 18, 2016 edited

Using sharp with my node application:

npm install
enclose -o ./myBin.bin ./app.js

There is a warning at the end (replacing my workspace path with [WORKSPACE])

warning Cannot include native addon into executable.
The addon file must be distributed with executable.

And then I ran the binary:

MODULE 31763: looking for "/thebox/[WORKSPACE]/node_modules/sharp/index.js/build/Release/sharp" in "/thebox/[WORKSPACE]/node_modules/sharp"
MODULE 31763: load "[WORKSPACE]/node_modules/sharp/build/Release/sharp.node" for module "[WORKSPACE]/node_modules/sharp/build/Release/sharp.node"

RangeError: index out of range
at checkOffset (buffer.js:614:11)
at Buffer.readInt16LE (buffer.js:749:5)
at e:0
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. (/thebox/[WORKSPACE]/node_modules/sharp/index.js:12:13)
at Module._compile (module.js:409:26)
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)

I have read the Enclose Homepage:

Native modules
Native modules (.node files) are supported for all platforms (more info, serialport example, oracle example).

EncloseJS cannot package a native module inside the executable.
You have to deploy your native modules along with your final executable.

So I have moved the .node files [WORKSPACE]/node_modules/sharp/build/Release/sharp.node to [WORKSPACE]/ but it doesn't resolve the issue.

What am I missing? How do I make sharp (or any *.node modules) work with Enclose?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment