← 返回命令列表

Linux command

node-gyp 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Configure project

node-gyp configure

Build native addon

node-gyp build

Clean build files

node-gyp clean

Rebuild (clean + configure + build)

node-gyp rebuild

Install Node.js headers

node-gyp install

Specify Node.js version

node-gyp rebuild --target=[18.0.0]

说明

node-gyp is a cross-platform build tool for compiling Node.js native addon modules. It uses GYP (Generate Your Projects) to create platform-specific build files. node-gyp requires Python and a C++ compiler (like gcc, clang, or MSVC).

参数

configure
Generate build files.
build
Build native addon.
clean
Remove build directory.
rebuild
Full rebuild.
install
Install Node.js headers.
--target _version_
Node.js version.
--debug
Debug build.
--arch _arch_
Target architecture.

FAQ

What is the node-gyp command used for?

node-gyp is a cross-platform build tool for compiling Node.js native addon modules. It uses GYP (Generate Your Projects) to create platform-specific build files. node-gyp requires Python and a C++ compiler (like gcc, clang, or MSVC).

How do I run a basic node-gyp example?

Run `node-gyp configure` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does configure do in node-gyp?

Generate build files.