Skip to content

build: pin node-addon-api 6.x at root to avoid MSBuild tlog race#319398

Merged
deepak1556 merged 1 commit into
mainfrom
robo/fix_msbuild_file_lock
Jun 2, 2026
Merged

build: pin node-addon-api 6.x at root to avoid MSBuild tlog race#319398
deepak1556 merged 1 commit into
mainfrom
robo/fix_msbuild_file_lock

Conversation

@deepak1556
Copy link
Copy Markdown
Collaborator

@vscode/spdlog, @vscode/windows-mutex, and @vscode/windows-process-tree all depend on node-addon-api ^7.1.0, so npm hoists a single copy to node_modules/node-addon-api. node-gyp then references it via a relative path that is one level too shallow, landing MSBuild artifacts under node_modules/@vscode/node-addon-api/ — a directory written to in parallel by every consumer. This races with tlog file generation

error MSB3501: Could not read lines from file "Release\obj\node_addon_api_except\node_add.C12341F3.tlog\node_addon_api_except.lastbuildstate". The process cannot access the file 'C:\Users\..\vscode\node_modules\@vscode\node-addon-api\Release\obj\node_addon_api_except\node_add.C12341F3.tlog\node_addon_api_except.lastbuildstate' because it is being used by another process.

After reading dotnet/msbuild#10814 msbuild already generates a unique folder under the parent directory. Adding an unused node-addon-api ^6.0.0 dep at the root occupies the hoisted slot without matching any real consumer, forcing each 7.1.0 consumer into its own private nested copy avoiding any file locks.

@deepak1556 deepak1556 added this to the 1.124.0 milestone Jun 1, 2026
@deepak1556 deepak1556 self-assigned this Jun 1, 2026
Copilot AI review requested due to automatic review settings June 1, 2026 17:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR mitigates a Windows MSBuild tlog race during parallel native module builds by preventing node-addon-api from being hoisted to the workspace root, forcing each consumer to get its own nested copy.

Changes:

  • Add a root-level node-addon-api ^6.0.0 dependency to occupy the hoisted slot.
  • Update root package-lock.json so node-addon-api@7.x is nested under each native-addon consumer instead of shared.
  • Apply the same dependency/lockfile change to remote/ to cover remote server builds as well.

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.

File Description
package.json Adds a root node-addon-api@^6.0.0 dependency to block hoisting of 7.x used by native addons.
package-lock.json Updates resolution so node-addon-api@7.x is nested per consumer, with root node-addon-api resolving to 6.1.0.
remote/package.json Mirrors the root change for the remote server package’s dependency graph.
remote/package-lock.json Mirrors the lockfile resolution updates for the remote server package.
Files not reviewed (1)
  • remote/package-lock.json: Language not supported

@deepak1556 deepak1556 merged commit 294fb35 into main Jun 2, 2026
52 checks passed
@deepak1556 deepak1556 deleted the robo/fix_msbuild_file_lock branch June 2, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants