rules_nodejs icon indicating copy to clipboard operation
rules_nodejs copied to clipboard

`taiko` broken by removal of symlinks to directories

Open fmeum opened this issue 3 years ago • 1 comments

🐞 bug report

Affected Rule

yarn_install

Is this a regression?

It worked before exports_directories_only became the default.

Description

On macOS, the NPM package taiko can't be used with rules_nodejs and exports_directories_only as it contains multiple symlinks to directories (since macOS Chromium does, which it downloads during installation) and some of these are deleted in https://github.com/bazelbuild/rules_nodejs/blob/696e134b592fe8543f3a6fa0f8ac683599cbb953/internal/npm_install/generate_build_file.ts#L640. Since that part of the code only does a single pass, it does produce broken symlinks where there weren't any before it ran.

This was first discovered in https://github.com/bazelbuild/rules_nodejs/issues/3381#issuecomment-1085527673, but not pursued further. The fix made in #3383 does not seem to be sufficient. Since it is not guaranteed that Chromium is usable without these symlinks, it seems better to remove the workaround,

🔬 Minimal Reproduction

Clone https://github.com/fmeum/rules_nodejs_3381 and run bazel build @npm//taiko.

🔥 Exception or Error


$ bazel build @npm//taiko
DEBUG: /private/var/tmp/_bazel_fmeum/f7c722126adf780f78b3836a48785b93/external/build_bazel_rules_nodejs/index.bzl:65:14:
node_repository attribute not set and no repository named
'nodejs_toolchains' exists; installing default node
DEBUG: /private/var/tmp/_bazel_fmeum/f7c722126adf780f78b3836a48785b93/external/build_bazel_rules_nodejs/index.bzl:73:14:
yarn_install#yarn attribute not set and no repository named 'yarn'
exists; installing default yarn
INFO: Analyzed target @npm//taiko:taiko (0 packages loaded, 0 targets
configured).
INFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_fmeum/f7c722126adf780f78b3836a48785b93/external/npm/BUILD.bazel:7197:10:
Error while validating output TreeArtifact File:[[]bazel-out/darwin_arm64-fastbuild/bin]external/npm/node_modules/taiko: Failed to resolve relative path .local-chromium/mac-967620/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Chromium Framework inside TreeArtifact /private/var/tmp/_bazel_fmeum/f7c722126adf780f78b3836a48785b93/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/external/npm/node_modules/taiko.
The associated file is either missing or is an invalid symlink.
ERROR: /private/var/tmp/_bazel_fmeum/f7c722126adf780f78b3836a48785b93/external/npm/BUILD.bazel:7197:10:
Copying directory external/npm/_/node_modules/taiko failed: not all
outputs were created or valid
Target @npm//taiko:taiko failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.540s, Critical Path: 1.20s
INFO: 2 processes: 1 internal, 1 darwin-sandbox.
FAILED: Build did NOT complete successfully

🌍 Your Environment

Operating System:

macOS

Output of bazel version:

5.1.0

Rules_nodejs version:

5.4.0

Anything else relevant?

fmeum avatar Apr 06 '22 10:04 fmeum

CC @gregmagolan

fmeum avatar Apr 06 '22 10:04 fmeum

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!

github-actions[bot] avatar Oct 07 '22 03:10 github-actions[bot]

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

github-actions[bot] avatar Nov 07 '22 03:11 github-actions[bot]