From 5d9beef84f54c7b1b5f5aa007a1cf29d0e57b190 Mon Sep 17 00:00:00 2001 From: Aman Karmani Date: Sun, 29 Dec 2024 05:47:42 -0800 Subject: [PATCH] fix: disable msbuild.exe nodeReuse On windows, one may experience errors due to concurrent node-gyp calls (see #3095) When retrying after such a failure, retries are observed to fail repeatedly with strange EBUSY and EPERM errors. This turns out to be due to a caching feature where msbuild.exe will continue to run in the background (for either 15s or 15m depending on VS version), and keep open file handles to files and directories that the user may be trying to delete (for example with a new call to `npm ci`). This behavior is well documented, as is the recommended workaround implemented here. --- lib/build.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/build.js b/lib/build.js index e1f49bb6ff..bca116b423 100644 --- a/lib/build.js +++ b/lib/build.js @@ -141,6 +141,8 @@ async function build (gyp, argv) { if (msvs) { // Turn off the Microsoft logo on Windows argv.push('/nologo') + // No lingering msbuild processes and open file handles + argv.push('/nodeReuse:false') } // Specify the build type, Release by default