Hi, I'm trying to setup bazel for my angular project: xLayers ( bazel branch ). I'm encountering this error after running a build command:
bazel build ...
Ouput:
Starting local Bazel server and connecting to it...
INFO: Analysed 36 targets (102 packages loaded).
INFO: Found 36 targets...
ERROR: /private/var/tmp/_bazel_wassim/a52e6be12b831a4a1e95901c31c1bbad/external/build_bazel_rules_typescript/internal/BUILD.bazel:31:1: Creating runfiles tree bazel-out/host/bin/external/build_bazel_rule
s_typescript/internal/tsc.runfiles [for host] failed: Process exited with status 1: Process exited with status 1
INFO: Elapsed time: 500.425s, Critical Path: 0.42s
INFO: 1 process: 1 darwin-sandbox.
FAILED: Build did NOT complete successfully
Clone this ( branch and just run a build command: bazel build ...
ProductName: Mac OS X
ProductVersion: 10.13.6
BuildVersion: 17G65
bazel info release
?Build label: 0.16.1
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Aug 13 13:42:50 2018 (1534167770)
Build timestamp: 1534167770
Build timestamp as int: 1534167770
git remote get-url origin ; git rev-parse master ; git rev-parse HEAD
?[email protected]:xlayers/xlayers.git
0917e0b524d93ae6d33ba4fe18e7aa95dc15f9b2
39cbf2b43502ae7bf2e3b887429b855119c49cee
This. But it's not solving this issue.
My env:
Bazel info:
Build label: 0.16.1
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Aug 13 13:42:50 2018 (1534167770)
Build timestamp: 1534167770
Build timestamp as int: 1534167770
Java info:
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
Issue openned in the bazelbuild/rules_typescript project as well.
cc @alexeagle
To be clear, the Bazel bug here is that the error reporting gave no output from the process that exited 1.
I saw the same in Bazel 0.17
That seems like a pretty bad bug. I'll investigate.
@philwo after you resolve it would you mind sharing real quick how you debugged it. I'd love to share with others so we can help more in the future.
I'm affected by this too. @philwo any update?
I'm really sorry, I currently don't have time to look into this in much detail. :( If you can give me a step of commands to run with which I can repro the failure, I can run a git bisect and find the commit that broke this.
I need something like "brew install some_dependency, then npm install other_dependency, git clone http://this/repo, then cd repo and bazel build //some:target, this works with Bazel 0.X.Y but it fails with the latest release".
@manekinekko do you have a link to a branch that is having the issues for xLayers?
@dslomov Tobi said you know stuff about runfiles - could you have a look?
This is the branch.
To reproduce, here are the steps:
When I try to run bazel run @yarn//:yarn
, I get
INFO: Options provided by the client:
Inherited 'common' options: --isatty=1 --terminal_columns=121
INFO: Reading rc options for 'build' from /Users/dslomov/work/bug6167/xlayers/.bazelrc:
'build' options: --strategy=TypeScriptCompile=worker --strategy=AngularTemplateCompile=worker --symlink_prefix=dist/ --define=compile=legacy --verbose_failures=true --announce_rc
ERROR: error loading package '': Encountered error while reading extension file 'package.bzl': no such package '@build_bazel_rules_typescript//': /private/var/tmp/_bazel_dslomov/82593653427950b84c6b07eece86838c/external/build_bazel_rules_typescript must be an existing directory
ERROR: error loading package '': Encountered error while reading extension file 'package.bzl': no such package '@build_bazel_rules_typescript//': /private/var/tmp/_bazel_dslomov/82593653427950b84c6b07eece86838c/external/build_bazel_rules_typescript must be an existing directory
INFO: Elapsed time: 0.107s
INFO: 0 processes.
Your WORKSPACE file has
# Runs the TypeScript compiler
local_repository(
name = "build_bazel_rules_typescript",
path = "node_modules/@bazel/typescript",
)
load("@build_bazel_rules_typescript//:package.bzl", "rules_typescript_dependencies")
rules_typescript_dependencies()
but my checkout does not have node_modules/@bazel/typescript
. How do I get that? (I guess I need to say npm install
something or other?)
Yeh, I think you need to run yarn install
before.
got it, looking
Next up:
$ bazel build ...
INFO: Options provided by the client:
Inherited 'common' options: --isatty=1 --terminal_columns=121
INFO: Reading rc options for 'build' from /Users/dslomov/work/bug6167/xlayers/.bazelrc:
'build' options: --strategy=TypeScriptCompile=worker --strategy=AngularTemplateCompile=worker --symlink_prefix=dist/ --define=compile=legacy --verbose_failures=true --announce_rc
ERROR: error loading package 'node_modules/@angular/bazel': Extension file not found. Unable to load package for '//tools:defaults.bzl': BUILD file not found on package path
INFO: Elapsed time: 1.045s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (9 packages loaded)
currently loading: ... (16 packages)
(node_modules/@angular/bazel/BUILD.bazel
has load("//tools:defaults.bzl", "npm_package")
- where is this file supposed to come from?)
@alexeagle any idea?
We shouldn't be building anything for Angular under node_modules.
(starting with Bazel 0.18 we'll recommend using the new .bazelignore to prevent bazel looking under node_modules at all)
But the real question for this issue is, how did you find that error? This is an error reporting issue in Bazel, in this context I don't care about fixing the root cause.
I don't think anyone has claimed to find a root cause for the OP. dslomov's errors look like they're just en route to trying to reproduce the error in the OP.
correct, I would like to get to a repro, and I am failing so far....
I've updated the @bazel/typescript
to 0.17.0
in my project and I think the issue is now gone.
I've also sync'ed the other config files WORKSPACE
and BUILD
and deps with those from the angular-bazel-example repo.
Now, I'm having other issues but probably not related to this one.
@dslomov - I also encountered this issue with the angular-bazel-example. My repro steps are here. I tried them again today with bazel 0.17.2 and I am still able to repro.
Make sure you checkout the exact commit I mentioned, otherwise it won't fail. As @manekinekko said, the typescript issue must've been fixed.
Found it:
link or target filename contains space on line 7951: 'angular_bazel_example/node_modules/randomcolor/demo/Edit fiddle - JSFiddle_files/OrbitControls.js
which would have been seen if all runfiles building output wasn't swallowed by Bazel. :)
Can this considered to be fixed thanks to https://github.com/bazelbuild/bazel/commit/c63e4fedda25f5b4f547d9142138030ea8f278e1 ?
SGTM, I think that change means that the error about "filename contains space" would now be discoverable to a user.
Most helpful comment
@philwo after you resolve it would you mind sharing real quick how you debugged it. I'd love to share with others so we can help more in the future.