Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

### What happened? #254

Description

@jakkal6

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

Originally posted by @jfirebaugh in bazel-contrib/rules_nodejs#3599

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions