node.js - node-gyp build 如何在构建 Node 扩展时指定目标 Node 版本

标签 node.js node-gyp

我正在为 Node native 插件从 node-waf 构建迁移到 node-gyp 构建系统。 node-gyp 说它支持多个目标版本,但我在使用 node-gyp 时找不到如何指定目标 Node 版本。

问题是,我的系统安装了 node v0.10.3,但我需要为 node 版本 0.8.20 构建我的 native 插件。当我构建附加组件时,它使用 v0.10.3 的 header ,这当然会出错。

我找不到如何在使用 node-gyp 配置/构建时指定 Node 版本。

请帮忙。

最佳答案

解决方案是在使用 node-gyp 配置时指定 --target 参数。例如。

node-gyp --arch=<WHATEVER> --target=v0.8.20 configure

关于node.js - node-gyp build 如何在构建 Node 扩展时指定目标 Node 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15964427/

相关文章:

javascript - CYTOSCAPE JS dijkstra 算法与预设布局

node.js - 将数据从两个模型发送到 View

python - 在节点 js (node-gyp) 中使用 npm install 安装 argon2 时出错

magento - 尝试在 WSL 上安装带有 node-sass 的应用程序。获取 "gyp ERR! stack Error: ` make` 失败,退出代码为 : 2"

c++ - OpenSSL:EC_POINT_set_compressed_coordinates_GFp 段错误

node.js - 无法使用 Electron 构建器构建应用程序。错误: gyp failed with exit code: 1

javascript - 使用 javascript 在 mongodb 终端中创建查询

node.js - 如何在 Fastify 服务器中解析 URL 中的查询字符串参数?

c++ - 带有 C++ 插件的 Node 应用程序在运行时提示 undefined symbol

node.js - Cosmos DB 通过部分文档更新进行增量