Skip to content

Commit 90a0f64

Browse files
gregmagolanalexeagle
authored andcommitted
Fix unlink failure for broken symlinks in generate_build_file.js
1 parent 0eb4a19 commit 90a0f64

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/npm_install/generate_build_file.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,11 @@ function deleteBazelFiles(pkg) {
430430
// Delete BUILD and BUILD.bazel files so that so that files do not cross Bazel packages
431431
// boundaries
432432
const fullPath = path.posix.join('node_modules', pkg._dir, file);
433+
if (!fs.existsSync(fullPath)) {
434+
// It is possible that the file no longer exists as reported in
435+
// https://github.com/bazelbuild/rules_nodejs/issues/522
436+
return false;
437+
}
433438
fs.unlinkSync(fullPath);
434439
return false;
435440
}

0 commit comments

Comments
 (0)