Linux command
npm-rebuild 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Rebuild all native modules
npm rebuild
Rebuild specific package
npm rebuild [package]
Rebuild for different Node version
npm rebuild --target=[18.0.0]
Rebuild globally installed packages
npm rebuild -g
说明
npm rebuild rebuilds native addon modules for the current Node.js version. This is necessary after upgrading Node.js or when native modules fail to load. The command runs node-gyp rebuild for each package with native code.
参数
- -g, --global
- Rebuild global packages.
- --ignore-scripts
- Don't run scripts.
- --foreground-scripts
- Run scripts in foreground.
FAQ
What is the npm-rebuild command used for?
npm rebuild rebuilds native addon modules for the current Node.js version. This is necessary after upgrading Node.js or when native modules fail to load. The command runs node-gyp rebuild for each package with native code.
How do I run a basic npm-rebuild example?
Run `npm rebuild` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -g, --global do in npm-rebuild?
Rebuild global packages.