【问题标题】:How can you configure node-gyp complied modules to use mutiple compile threads, like -j8?如何配置 node-gyp 编译模块以使用多个编译线程,如 -j8?
【发布时间】:2020-06-24 00:57:32
【问题描述】:

我注意到编译 C 代码的所有节点模块都只运行单线程编译。

由于我经常会多次重试节点模块安装,因此至少 C 编译会利用所有内核会很好。

有没有办法为此将 j 标志传递给 C 编译器?

【问题讨论】:

    标签: node.js compilation node-gyp


    【解决方案1】:

    node-gyp 使用JOBS 环境变量,提高它会导致更多进程编译。示例:JOBS=max node-gyp build

    或者,如果您在运行 node-gyp 之前运行 export MAKEFLAGS=-j8,则可以直接传递 Make 标志。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-16
      • 1970-01-01
      • 2015-08-01
      • 2021-02-07
      • 2011-09-29
      相关资源
      最近更新 更多