Skip to content

[Bug]: bazel test //examples/npm_deps:test10 fails on windows with bazel 8+ #2261

@peakschris

Description

@peakschris

What happened?

We have an issue in our repo that prevents any of our tests from running. I have found the same issue in rules_js itself. It appears to have regressed between bazel 7.6.1 and bazel 8.0.0 and is still failing with bazel 8.3.1 and coincidentally perhaps I have noticed that the node symlinks were previously displayed as 'SYMLINKD' but in bazel 8.0.0+ are displayed as 'JUNCTION'

Setup:
git clone rules_js

%workspace%/windows.bazelrc:

# Enable platform specific config
common --enable_platform_specific_config

# Enable symlinks on windows
startup --windows_enable_symlinks

# Runfiles are disabled by default on Windows but rules_js requires them.
common:windows --enable_runfiles

Add to .bazelrc:

import %workspace%/windows.bazelrc

Update .bazelversion:

8.0.0

bazel test //examples/npm_deps:test10

INFO: From Testing //examples/npm_deps:test10:
DEBUG: D:/workdir/github/rules_js/npm/private/npm_translate_lock_state.bzl:27:14:
WARNING: `update_pnpm_lock` attribute in `npm_translate_lock(name = "npm")` is not yet supported on Windows. This feature will be disabled for this build.
==================== Test output for //examples/npm_deps:test10:
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '@mycorp/pkg-e'
Require stack:
- D:\udu\b\6fsffodd\execroot\_main\bazel-out\x64_windows-fastbuild\bin\examples\npm_deps\test10_\test10.bat.runfiles\_main\examples\npm_deps\case10.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (D:\udu\b\6fsffodd\execroot\_main\bazel-out\x64_windows-fastbuild\bin\examples\npm_deps\test10_\test10.bat.runfiles\_main\examples\npm_deps\case10.js:1:1)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'D:\\udu\\b\\6fsffodd\\execroot\\_main\\bazel-out\\x64_windows-fastbuild\\bin\\examples\\npm_deps\\test10_\\test10.bat.runfiles\\_main\\examples\\npm_deps\\case10.js'
  ]
}
================================================================================
INFO: Build completed, 1 test FAILED, 20 total actions
//examples/npm_deps:test10                                               FAILED in 0.7s

dir "bazel-out\x64_windows-fastbuild\bin\examples\npm_deps\test10_\test10.bat.runfiles_main\node_modules.aspect_rules_js@[email protected]\node_modules@mycorp"

07/06/2025  07:51 AM    <JUNCTION>     pkg-d [D:\udu\b\6fsffodd\execroot\_main\bazel-out\x64_windows-fastbuild\bin\examples\npm_package\packages\pkg_d]

Update .bazelversion

7.6.1

bazel clean
bazel test //examples/npm_deps:test10

DEBUG: D:/workdir/github/rules_js/npm/private/npm_translate_lock_state.bzl:27:14:
WARNING: `update_pnpm_lock` attribute in `npm_translate_lock(name = "npm")` is not yet supported on Windows. This feature will be disabled for this build.
INFO: Build completed successfully, 20 total actions
//examples/npm_deps:test10                                               PASSED in 0.9s

dir "bazel-out\x64_windows-fastbuild\bin\examples\npm_deps\test10_\test10.bat.runfiles_main\node_modules.aspect_rules_js@[email protected]\node_modules@mycorp"

07/06/2025  07:54 AM    <SYMLINKD>     pkg-d [\\?\D:\udu\b\6fsffodd\execroot\_main\bazel-out\x64_windows-fastbuild\bin\examples\npm_package\packages\pkg_d]

Version

Development (host) and target OS/architectures:
Windows 10

Output of bazel --version:
8.0.0

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:
Latest

Language(s) and/or frameworks involved:

How to reproduce

Any other information?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedAspect isn't prioritizing this, but the community couldwindowsSpecific to Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions