bazelbuild / rules_nodejs

NodeJS toolchain for Bazel.

Home Page:https://bazelbuild.github.io/rules_nodejs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: `bazel fetch @nodejs_host//...` fails

jfirebaugh opened this issue · comments

What happened?

Suppose you want to use bazel fetch to prefetch repositories for the node toolchain.

With this WORKSPACE (verbatim from https://github.com/aspect-build/rules_js/releases/tag/v1.6.9):

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "aspect_rules_js",
    sha256 = "dda5fee3926e62c483660b35b25d1577d23f88f11a2775e3555b57289f4edb12",
    strip_prefix = "rules_js-1.6.9",
    url = "https://github.com/aspect-build/rules_js/archive/refs/tags/v1.6.9.tar.gz",
)

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")

rules_js_dependencies()

load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")

nodejs_register_toolchains(
    name = "nodejs",
    node_version = DEFAULT_NODE_VERSION,
)

Run bazel fetch @nodejs_host//....

Expected result: the command succeeds.
Actual result: the command fails with this error:

➜  rules_nodejs_bug bazel fetch @nodejs_host//...
ERROR: /private/var/tmp/_bazel_john/442663b197eb6942a605345c9a9c84f6/external/nodejs_host/BUILD.bazel:4:6: no such target '@nodejs_darwin_arm64//:run_npm.sh.template': target 'run_npm.sh.template' not declared in package '' (did you mean 'run_npm.template'?) defined by /private/var/tmp/_bazel_john/442663b197eb6942a605345c9a9c84f6/external/nodejs_darwin_arm64/BUILD.bazel and referenced by '@nodejs_host//:run_npm.sh.template'
ERROR: /private/var/tmp/_bazel_john/442663b197eb6942a605345c9a9c84f6/external/nodejs_host/BUILD.bazel:5:6: no such target '@nodejs_darwin_arm64//:run_npm.bat.template': target 'run_npm.bat.template' not declared in package '' (did you mean 'run_npm.template'?) defined by /private/var/tmp/_bazel_john/442663b197eb6942a605345c9a9c84f6/external/nodejs_darwin_arm64/BUILD.bazel and referenced by '@nodejs_host//:run_npm.bat.template'
ERROR: /private/var/tmp/_bazel_john/442663b197eb6942a605345c9a9c84f6/external/nodejs_host/BUILD.bazel:4:6: no such target '@nodejs_darwin_arm64//:run_npm.sh.template': target 'run_npm.sh.template' not declared in package '' (did you mean 'run_npm.template'?) defined by /private/var/tmp/_bazel_john/442663b197eb6942a605345c9a9c84f6/external/nodejs_darwin_arm64/BUILD.bazel and referenced by '@nodejs_host//:run_npm.sh.template'
ERROR: Evaluation of query "deps(@nodejs_host//...)" failed: errors were encountered while computing transitive closure
Loading: 2 packages loaded

Version

Development (host) and target OS/architectures:

Output of bazel --version:

Version of rules_nodejs, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

Language(s) and/or frameworks involved:

How to reproduce

No response

Any other information?

No response

This issue has been automatically marked as stale because it has not had any activity for 6 months. It will be closed if no further activity occurs in 30 days. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs!

This issue was automatically closed because it went 30 days without any activity since it was labeled "Can Close?"