Skip to content

Yarn install runs on every build #3515

Description

@yohcop

🐞 bug report

Affected Rule

The issue is caused by the rule: rules_nodejs

Is this a regression?

I don't think so, but I'm not sure.

Description

On every build, even a "repeat build" immediately after a successful build, yarn install is re-ran, even if package.json, or yarn.lock are unchanged.

🔬 Minimal Reproduction

bazel build //some:target # -> success
bazel build //some:target # -> reruns yarn install

🌍 Your Environment

Operating System:

  
$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
  

Output of bazel version:

  
$ bazel version
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:

(Please check that you have matching versions between WORKSPACE file and @bazel/* npm packages.)

  
$ cat WORKSPACE | grep -B1 -A3 build_bazel_rules_nodejs
http_archive(
    name = "build_bazel_rules_nodejs",
    sha256 = "e328cb2c9401be495fa7d79c306f5ee3040e8a03b2ebb79b022e15ca03770096",
    urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.4.2/rules_nodejs-5.4.2.tar.gz"],
)
$ cat package.json | grep bazel
    "@bazel/esbuild": "5.4.2",
    "@bazel/jasmine": "5.4.2",
    "@bazel/typescript": "5.4.2",
  

Anything else relevant?

See this trace from the second build which should be near instant.
Screenshot 2022-07-31 11 12 11

You can see the //external:npm running for nearly 17s in my project, out of the 25 total for that build.

This is especially visible and costly with ibazel when the incremental rebuilds should be very small.

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