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

@nodejs_host//:yarn no such target

dgnemo opened this issue Β· comments

🐞 bug report

In multiple place in the code and in the documentation it's mentioned to execute
bazel run @nodejs_host//:yarn install to update a dependency or install a new one

vendored yarn binary. `bazel run @nodejs_host//:yarn install`. You can pass the options like

but the command bazel run @nodejs_host//:yarn install does not work (target does not exist),
even on a repo created following the quickstart directions.

πŸ”¬ Minimal Reproduction

$ npx @bazel/create workspace --packageManager=yarn
Creating Bazel workspace workspace...
Successfully created new Bazel workspace at /home/diego/js-bazel-test/workspace
Next steps:
  1. cd workspace
  2. yarn install
  3. yarn build
     Note that there is nothing to build, so this trivially succeeds.
  4. Add contents to the BUILD.bazel file or create a new BUILD.bazel in a subdirectory.

$ cd workspace
$ bazel run @nodejs_host//:yarn
INFO: Invocation ID: 714bcd52-86e6-41d8-bf43-3487a91f6d99
ERROR: Skipping '@nodejs_host//:yarn': no such target '@nodejs_host//:yarn': target 'yarn' not declared in package '' defined by /home/--/.cache/bazel/_bazel_--/6ab1a205e0a75010d0a8dd8cfcbcb536/external/nodejs_host/BUILD.bazel
WARNING: Target pattern parsing failed.
ERROR: no such target '@nodejs_host//:yarn': target 'yarn' not declared in package '' defined by /home/--/.cache/bazel/_bazel_--/6ab1a205e0a75010d0a8dd8cfcbcb536/external/nodejs_host/BUILD.bazel
INFO: Elapsed time: 0.473s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)

$ bazel query @nodejs_host//...
@nodejs_host//:node
@nodejs_host//:node_bin
@nodejs_host//:node_files
@nodejs_host//:npm
@nodejs_host//:npm_bin
@nodejs_host//:npm_files
@nodejs_host//:npx_bin
@nodejs_host//:run_npm.bat.template
@nodejs_host//:run_npm.sh.template
Loading: 0 packages loaded

πŸ”₯ Exception or Error

'@nodejs_host//:yarn': no such target '@nodejs_host//:yarn': target 'yarn' not declared in package ''
defined by /home/--/.cache/bazel/_bazel_--/6ab1a205e0a75010d0a8dd8cfcbcb536/external/nodejs_host/BUILD.bazel

🌍 Your Environment

Operating System: Linux

Output of bazel version:

$ bazel version
Bazelisk version: development
Build label: 5.0.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Jan 19 14:08:54 2022 (1642601334)
Build timestamp: 1642601334
Build timestamp as int: 1642601334

Rules_nodejs version: 5.5.3