Search code examples
node.jscompilationnode-gyp

How can you configure node-gyp complied modules to use mutiple compile threads, like -j8?


I've noticed that all node modules that compile C code are running only a single threaded compile.

As it often happens that I end up retrying node module installations multiple times, it would be nice at least that the C compile would utilise all cores.

is there some way to pass the j flag to the C compiler for this?


Solution

  • node-gyp uses the JOBS environment variable, raising it will result in more processes compiling. Example: JOBS=max node-gyp build

    Alternatively, you can pass the Make flags directly, if you run export MAKEFLAGS=-j8 before running node-gyp.