What is node-gyp

selftaught91 picture selftaught91 · Sep 28, 2016 · Viewed 70.1k times · Source

Can anyone explain me what is node-gyp and why it uses my system files to build Node.JS packages.

  1. If Ii build a node project and it used node-gyp internally.
  2. Then I just tar that project and moved to a different system
  3. I untar it there and try to use it

Will this approach work?

Answer

vuza picture vuza · Sep 28, 2016

node-gyp is a tool which compiles Node.js Addons. Node.js Addons are native Node.js Modules, written in C or C++, which therefore need to be compiled on your machine. After they are compiled with tools like node-gyp, their functionality can be accessed via require(), just as any other Node.js Module.

If you do what you suggested the module won't work, you will need to compile it/build it with node-gyp on the system you moved the program to.

node-gyp: https://github.com/nodejs/node-gyp

Node.js Addons: https://nodejs.org/api/addons.html