# node-gyp-example **Repository Path**: cnxzq/node-gyp-example ## Basic Information - **Project Name**: node-gyp-example - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-15 - **Last Updated**: 2025-10-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # node-gyp 示例 * 1. 编写 `addon.cc` 文件 * 1. 编写 `binding.gyp` 文件 * 1. 执行 `node-gyp configure` 命令 * 1. 执行构建 `node-gyp build` 其他命令 * node-gyp clean * node-gyp rebuild ## 相关模块 * `node-gyp` Node.js 原生扩展编译工具(核心构建系统)输出 xxx.node * `node-addon-api` Node.js 官方维护的 C++ 封装层(N-API 封装) * `node-gyp-build` 辅助包-运行时自动加载编译结果(或预编译二进制) 无需手动加载 无需手动 xxx.node * `prebuildify` 构建跨平台预编译 .node 文件,便于 npm 直接发布,配合 node-gyp-build 自动加载,跨平台完美兼容。 * `node-api` / `N-API`(Node 内置)Node.js 原生 API 层(C 语言接口) * `nan` 旧版 Node C++ 接口封装(⚠️ 已过时,node-addon-api 替代) * `cmake-js` 替代 node-gyp 的构建系统(使用 CMake,适合大型工程) ## 2025最佳组合 | 功能 | 推荐包 | | ------------- | ---------------- | | 构建系统 | `node-gyp` | | C++ 封装层 | `node-addon-api` | | 运行时加载 | `node-gyp-build` | | 预编译发布 | `prebuildify` | | TypeScript 支持 | `@types/node` |