igorklopov / enclose

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

Error with MongoDB driver - native kerberos module #66

Closed seti123 closed 9 years ago

seti123 commented 9 years ago

Hi, great work. I like this very much to ship a single file as it is complicated to provide setups for node on all platforms or tell users how to install node... anyhow, I've got not far with a current project using MongoDB driver. As far I understood native modules are supported, but I've got this error on Mac OS X:

/Users/stefan/myproject/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/kerberos.node
  warning  Cannot include native addon into executable
  The addon package must be distributed with executable

As far I understand Kerberos is an optional dependency in MongoDB driver, from mongodb-core package:

"peerDependencies": {
    "kerberos": "~0.0"
  },

What could I do to compile my project using MongoDB driver?

igorklopov commented 9 years ago

First of all, native modules (kerberos.node file in your case) can not be placed inside executable. You must ship them with final executable (you will need to ship yourproject.exe and kerberos.node). So, it is ok that you see that warning. It does not stop compilation and you still can get working executable.

Do you get working executable? Do you see errors when running it?

seti123 commented 9 years ago

Thank you - finally it works. Q: Would it be possible to include the native module (kerberos.node) in the package, and unpack/extract it before the actual application code gets executed? Just an idea.

Actually there are a few other problems, like dynamic loading of modules (e.g. using require(variable) to load plugins, with module names from configuration files). This dependencies can't be resolved, so in my test I did replace such code with static strings - anyhow at the end the binary file was created and starts.