Skip to content

Vendored Yarn support not compatible with Windows #3349

Description

@devversion

🐞 bug report

Affected Rule

yarn_install

Is this a regression?

No

Description

The docs mention that for vendored Yarn versions, the yarn attribute can just point to the js file when yarn_install is defined. This is not as easy in reality though because it means that the system Node versions would be used, and also it would break on Windows which does not necessarily know how to automatically resolve .js or .cjs from the path extensions.

https://github.com/bazelbuild/rules_nodejs/blob/7993296829c5ddaadb04a7d76ecc6b72eacdd01c/nodejs/yarn_repositories.bzl#L45-L48

Error in fail: yarn --version failed:  (java.io.IOException: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("C:\users\circleci\project\.yarn\releases\yarn-3.2.0.cjs" --version): %1 is not a valid Win32 application.

Ideally the wrapper (which leverages the nodejs_host) from yarn_repositories would be exposed somehow, or yarn_repositories would take in the regular JS file and set up the wrapper as it would do when downloading.

🔬 Minimal Reproduction

  1. Checkout angular/dev-infra@9604d04
  2. Run bazel build //...

🔥 Exception or Error


Error in fail: yarn --version failed:  (java.io.IOException: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("C:\users\circleci\project\.yarn\releases\yarn-3.2.0.cjs" --version): %1 is not a valid Win32 application.

Rules_nodejs version:

5.2.0

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