运行yarn install时如何避免node-gyp重建?

Jin*_* Li 6 rebuild node.js node-gyp yarnpkg node-addon-api

当我运行时yarn install,我的本机插件总是被重建。可以看出,即使没有更新任何内容,也node-gyp rebuild运行命令而不是node-gyp build

caros@ubuntu:~/Developer/xviz-converter$ yarn install
yarn install v1.16.0
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
$ node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@10.16.0 | linux | x64
gyp info spawn /usr/bin/python2
....
Run Code Online (Sandbox Code Playgroud)

如何让纱线运行node-gyp build而不是node-gyp rebuild?完全重建非常耗时。

Mic*_*hal 2

您可以运行安装命令并忽略脚本。请注意,这可能会破坏其他库。

yarn install --ignore-scripts
Run Code Online (Sandbox Code Playgroud)

https://classic.yarnpkg.com/en/docs/cli/install/#toc-yarn-install-ignore-scripts

不要执行项目 package.json 及其依赖项中定义的任何脚本。