2

how to convert NODE MODULES into binaries to support all platform.

  • Windows x86
  • Windows X64
  • Linux
  • OS X

and load those binaries in Node application instead of npm modules. ?

Jon Surrell
  • 9,444
  • 8
  • 48
  • 54
Shan Khan
  • 9,667
  • 17
  • 61
  • 111

2 Answers2

2

A good starting point might be to take a look at http://cylonjs.com/blog/2014/11/19/creating-multiplatform-precompiled-binaries-for-node-modules/

It would help if you could clarify your question, since I'm not sure exactly what you are trying to achieve. I answered on the assumption that you have binaries you want to include for node modules on multiple platforms (see link above). Otherwise, just having node modules installed as part of an application should be the same as adding them as a dependency in the package.json.

ryzngard
  • 136
  • 7
  • i only have modules i want to convert those modules into pre compiled binaries and then load those binaries in my node application. – Shan Khan Dec 16 '15 at 11:26
1

i want to convert those modules into pre compiled binaries and then load those binaries in my node application

Two questions here: 1) How to convert Node.js modules written in JavaScript into binaries executable on your platform and 2) How to use such compiled binary executables as part of your Node.JS application.

A great answer to question 1) is a tool called Zeit PKG at: https://github.com/zeit/pkg

I have used Zeit PKG to compile my Node.js application into a Windows-10 executable, and it works. Zeit PKG has options to target other platforms like Linux as well but I haven't tested that.

I would like to learn the answer to the 2nd question myself, (how) can an .exe -file (with some restrictions and/or wrapping) be used as a module in a Node.js application?

Panu Logic
  • 2,193
  • 1
  • 17
  • 21