Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bazel ng-new schematic doesn't handle less stylesheet format correctly #31209

Closed
henning96 opened this issue Jun 22, 2019 · 10 comments

Comments

Projects
None yet
6 participants
@henning96
Copy link

commented Jun 22, 2019

馃悶 bug report

Affected Package

The issue is caused by package @angular/bazel.

Is this a regression?

No, this never worked.

Description and Minimal Reproduction

The Bazel ng-new schematic doesn't seem to respect the less stylesheet format option.
I've followed the instructions on https://blog.angular.io/try-bazels-opt-in-preview-in-angular-cli-b9430bd00e82 to create a new Bazel project and selected less as my stylesheet format.
When trying to build the generated project, the build fails with the message:
index out of range (index is 0, but sequence has 0 elements) in sass_binary.

馃敩 Minimal Reproduction

Create a new Bazel project by using the command:
ng new my-app --collection=@angular/bazel and choose the less stylesheet format option.
Then try to build the project by running ng build.

馃敟 Exception or Error


ERROR: workspace_root/src/BUILD.bazel:12:9: Traceback (most recent call last):
        File "workspace_root/src/BUILD.bazel", line 10
                sass_binary(name = "global_stylesheet", src = ...], ...")
        File "workspace_root/src/BUILD.bazel", line 12, in sass_binary
                glob(["styles.css", "styles.scss"])[0]
index out of range (index is 0, but sequence has 0 elements)
ERROR: error loading package 'src': Package 'src' contains errors

馃實 Your Environment

Angular Version:


Angular CLI: 8.0.3
Node: 12.4.0
OS: darwin x64
Angular: 8.0.2
... animations, bazel, common, compiler, compiler-cli, core
... forms, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.3
@angular-devkit/build-angular     0.800.3
@angular-devkit/build-optimizer   0.800.3
@angular-devkit/build-webpack     0.800.3
@angular-devkit/core              8.0.3
@angular-devkit/schematics        8.0.3
@angular/cli                      8.0.3
@bazel/bazel                      0.26.1
@bazel/ibazel                     0.10.3
@bazel/karma                      0.31.1
@bazel/typescript                 0.31.1
@ngtools/webpack                  8.0.3
@schematics/angular               8.0.3
@schematics/update                0.800.3
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.30.0
@perjerz3434

This comment has been minimized.

Copy link

commented Jun 22, 2019

same issue

Angular CLI: 8.0.3
Node: 10.15.3
OS: darwin x64
Angular: 8.0.2
... animations, bazel, common, compiler, compiler-cli, core
... forms, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.3
@angular-devkit/build-angular     0.800.3
@angular-devkit/build-optimizer   0.800.3
@angular-devkit/build-webpack     0.800.3
@angular-devkit/core              8.0.3
@angular-devkit/schematics        8.0.3
@angular/cli                      8.0.3
@bazel/bazel                      0.26.1
@bazel/bazel-darwin_x64           0.26.1
@bazel/ibazel                     v0.10.3
@bazel/karma                      0.31.1
@bazel/typescript                 0.31.1
@ngtools/webpack                  8.0.3
@schematics/angular               8.0.3
@schematics/update                0.800.3
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.30.0
@perjerz3434

This comment has been minimized.

Copy link

commented Jun 22, 2019

I has changed the project to css. The first build is fine.

INFO: Analyzed target //src:prodapp (528 packages loaded, 19286 targets configured).
INFO: Found 1 target...
Target //src:prodapp up-to-date:
  dist/bin/src/prodapp
INFO: Elapsed time: 97.560s, Critical Path: 28.03s
INFO: 7 processes: 6 local, 1 worker.
INFO: Build completed successfully, 8102 total actions

However, I ran ng serve
I got the error message.

ng serve 
Error getting Bazel info exec: "bazel": executable file not found in $PATH
error setting higher file descriptor limit for this process: invalid argumentQuerying for files to watch...
Bazel query failed: exec: "bazel": executable file not found in $PATH
Bazel query failed: exec: "bazel": executable file not found in $PATH
Runing //src:devserver
Error running Bazel exec: "bazel": executable file not found in $PATH
/Users/perjerz/bazel/node_modules/@bazel/ibazel/bin/darwin_amd64/ibazel failed with code 4.

This error leads to bazelbuild/bazel-watcher#252

After that I ran

npm install -g @bazel/bazel

Then, I got this error.

ng serve                   
error setting higher file descriptor limit for this process: invalid argumentQuerying for files to watch...
Loading: 0 packages loaded
ERROR: /private/var/tmp/_bazel_perjerz/e94172a9a26676c96635c93e5554594c/external/build_bazel_rules_sass_deps/sass/BUILD.bazel:249:1: no such package '@build_bazel_rules_sass_deps//node_modules/sass': BUILD file not found in directory 'node_modules/sass' of external repository @build_bazel_rules_sass_deps and referenced by '@build_bazel_rules_sass_deps//sass:sass'
Loading: 17 packages loaded
Loading: 17 packages loaded
Loading: 22 packages loaded
Loading: 154 packages loaded
    currently loading: @npm//node_modules/arr-union
ERROR: /private/var/tmp/_bazel_perjerz/e94172a9a26676c96635c93e5554594c/external/io_bazel_rules_sass/sass/BUILD:11:1: no such package '@build_bazel_rules_sass_deps//node_modules/sass': BUILD file not found in directory 'node_modules/sass' of external repository @build_bazel_rules_sass_deps and referenced by '@io_bazel_rules_sass//sass:sass_bin'
ERROR: /private/var/tmp/_bazel_perjerz/e94172a9a26676c96635c93e5554594c/external/build_bazel_rules_sass_deps/sass/BUILD.bazel:249:1: no such package '@build_bazel_rules_sass_deps//node_modules/sass': BUILD file not found in directory 'node_modules/sass' of external repository @build_bazel_rules_sass_deps and referenced by '@build_bazel_rules_sass_deps//sass:sass'
ERROR: Evaluation of subquery "deps(set(//src:devserver))" failed (did you want to use --keep_going?): errors were encountered while computing transitive closure
Loading: 266 packages loaded
Loading: 266 packages loaded
Bazel query failed: exit status 7
Loading: 0 packages loaded
ERROR: /private/var/tmp/_bazel_perjerz/e94172a9a26676c96635c93e5554594c/external/io_bazel_rules_sass/sass/BUILD:11:1: no such package '@build_bazel_rules_sass_deps//node_modules/sass': BUILD file not found in directory 'node_modules/sass' of external repository @build_bazel_rules_sass_deps and referenced by '@io_bazel_rules_sass//sass:sass_bin'
ERROR: /private/var/tmp/_bazel_perjerz/e94172a9a26676c96635c93e5554594c/external/build_bazel_rules_sass_deps/sass/BUILD.bazel:249:1: no such package '@build_bazel_rules_sass_deps//node_modules/sass': BUILD file not found in directory 'node_modules/sass' of external repository @build_bazel_rules_sass_deps and referenced by '@build_bazel_rules_sass_deps//sass:sass'
ERROR: Evaluation of subquery "deps(set(//src:devserver))" failed (did you want to use --keep_going?): errors were encountered while computing transitive closure
Loading: 0 packages loaded
Loading: 0 packages loaded
Bazel query failed: exit status 7
Runing //src:devserver
Loading: 0 packages loaded
Loading: 0 packages loaded

Loading: 0 packages loaded
Launching with notifications
listening on :35729
Loading: 
Loading: 0 packages loaded
Analyzing: target //src:devserver (1 packages loaded, 0 targets configured)
ERROR: /private/var/tmp/_bazel_perjerz/e94172a9a26676c96635c93e5554594c/external/io_bazel_rules_sass/sass/BUILD:11:1: no such package '@build_bazel_rules_sass_deps//node_modules/sass': BUILD file not found in directory 'node_modules/sass' of external repository @build_bazel_rules_sass_deps and referenced by '@io_bazel_rules_sass//sass:sass_bin'
ERROR: Analysis of target '//src:devserver' failed; build aborted: no such package '@build_bazel_rules_sass_deps//node_modules/sass': BUILD file not found in directory 'node_modules/sass' of external repository @build_bazel_rules_sass_deps
INFO: Elapsed time: 0.763s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (19 packages loaded, 41 targets configured)
ERROR: Build failed. Not running target
FAILED: Build did NOT complete successfully (19 packages loaded, 41 targets configured)
Error starting process: fork/exec /var/folders/vl/wp3bydl53fvcy8gh1dvnfqxh0000gn/T/bazel_script_path469790526: permission denied
Run start failed fork/exec /var/folders/vl/wp3bydl53fvcy8gh1dvnfqxh0000gn/T/bazel_script_path469790526: permission denied
Triggering live reload
requesting reload: reload

I deleted my project and generated new app. I always get this error when I try to ng build

Starting local Bazel server and connecting to it...
ERROR: /private/var/tmp/_bazel_perjerz/e94172a9a26676c96635c93e5554594c/external/io_bazel_rules_sass/sass/BUILD:11:1: no such package '@build_bazel_rules_sass_deps//node_modules/sass': BUILD file not found on package path and referenced by '@io_bazel_rules_sass//sass:sass_bin'
ERROR: Analysis of target '//src:prodapp' failed; build aborted: no such package '@build_bazel_rules_sass_deps//node_modules/sass': BUILD file not found on package path
INFO: Elapsed time: 4.445s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (189 packages loaded, 1663 targets\
 configured)
    Fetching @local_config_cc; fetching

Therefore, my guess is about build bazel rules are invalid after first build. I deleted all files in folder /private/var/tmp/_bazel_perjerz/, and run ng build again. It works fine again.

Extracting Bazel installation...
Starting local Bazel server and connecting to it...
INFO: SHA256 (https://github.com/manekinekko/rules_sass/archive/9862dfc96a4a1f66fe171ef5e043b29853e8445b.zip) = 6035f25dbcd1e5575a681f5d7b9d9821dde09fcf73ccea053d1bc1c9523b1a2a
DEBUG: Rule 'io_bazel_rules_sass' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "6035f25dbcd1e5575a681f5d7b9d9821dde09fcf73ccea053d1bc1c9523b1a2a"
INFO: Analyzed target //src:prodapp (528 packages loaded, 19286 targets configured).
INFO: Found 1 target...
Target //src:prodapp up-to-date:
  dist/bin/src/prodapp
INFO: Elapsed time: 195.176s, Critical Path: 33.13s
INFO: 7 processes: 6 local, 1 worker.
INFO: Build completed successfully, 8102 total actions

The second build takes ~9 seconds.

INFO: Analyzed target //src:prodapp (528 packages loaded, 19286 targets configured).
INFO: Found 1 target...
Target //src:prodapp up-to-date:
  dist/bin/src/prodapp
INFO: Elapsed time: 8.895s, Critical Path: 0.09s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action

My problem is now about run ng serve which invoking ibazel to be run, and it totally break the bazel rules to be not found.

@forssri

This comment has been minimized.

Copy link

commented Jun 23, 2019

I am facing similar issues, creating a new project using 8.0.3 angular and latest @angular/bazel and latest @bazel/bazel fails for both ng serve and ng build. This doesn't seem to be a failure related to LESS, tried with choosing either CSS/SASS while creating a new project as well

Analyzing: target //src:devserver (1 packages loaded, 0 targets configured) ERROR: /private/var/tmp/_bazel_sriram/67919b6f64079d0c1fa653a6ec12dcff/external/bazel_tools/tools/bash/runfiles/BUILD:1:1: in @build_bazel_rules_nodejs//internal/common:sources_aspect.bzl%sources_aspect aspect on sh_library rule @bazel_tools//tools/bash/runfiles:runfiles: Traceback (most recent call last): File "/private/var/tmp/_bazel_sriram/67919b6f64079d0c1fa653a6ec12dcff/external/bazel_tools/tools/bash/runfiles/BUILD", line 1 @build_bazel_rules_nodejs//internal/common:sources_aspect.bzl%sources_aspect(...) File "/private/var/tmp/_bazel_sriram/67919b6f64079d0c1fa653a6ec12dcff/external/build_bazel_rules_nodejs/internal/common/sources_aspect.bzl", line 40, in _sources_aspect_impl depset([f for f in target.files if f.pa...")], ...]) File "/private/var/tmp/_bazel_sriram/67919b6f64079d0c1fa653a6ec12dcff/external/build_bazel_rules_nodejs/internal/common/sources_aspect.bzl", line 41, in depset [f for f in target.files if f.path.endswith(".js")] type 'depset' is not iterable. Use the to_list()method to get a list. Use --incompatible_depset_is_not_iterable=false to temporarily disable this check.

@ngbot ngbot bot added this to the needsTriage milestone Jun 24, 2019

@alan-agius4

This comment has been minimized.

Copy link
Contributor

commented Jun 24, 2019

Hi, at the moment bazel only supports CSS and SASS.

With regards to the users experiencing other errors, I suggest that a new issue is opening. Since the errors that you are experiencing are not related to the original issue.

Thanks.

@gurezo

This comment was marked as off-topic.

Copy link

commented Jun 24, 2019

Hi @alan-agius4 !
both CSS and SASS fail to create a project me too.
Is this a problem with versions such as angular/cli?

鉃  ~ npm install -g @angular/bazel
/Users/lifewood/.nodebrew/node/v10.14.1/bin/ngc-wrapped -> /Users/lifewood/.nodebrew/node/v10.14.1/lib/node_modules/@angular/bazel/src/ngc-wrapped/index.js
/Users/lifewood/.nodebrew/node/v10.14.1/bin/api-extractor -> /Users/lifewood/.nodebrew/node/v10.14.1/lib/node_modules/@angular/bazel/src/api-extractor/index.js
/Users/lifewood/.nodebrew/node/v10.14.1/bin/packager -> /Users/lifewood/.nodebrew/node/v10.14.1/lib/node_modules/@angular/bazel/src/ng_package/packager.js
/Users/lifewood/.nodebrew/node/v10.14.1/bin/xi18n -> /Users/lifewood/.nodebrew/node/v10.14.1/lib/node_modules/@angular/bazel/src/ngc-wrapped/extract_i18n.js
/Users/lifewood/.nodebrew/node/v10.14.1/bin/modify_tsconfig -> /Users/lifewood/.nodebrew/node/v10.14.1/lib/node_modules/@angular/bazel/src/modify_tsconfig.js
npm WARN @angular/bazel@8.0.2 requires a peer of @angular/compiler-cli@8.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/bazel@8.0.2 requires a peer of @bazel/typescript@0.* but none is installed. You must install peer dependencies yourself.
npm WARN @angular/bazel@8.0.2 requires a peer of typescript@>=3.4 <3.5 but none is installed. You must install peer dependencies yourself.

+ @angular/bazel@8.0.2
added 66 packages from 104 contributors in 9.781s
鉃  ~ cd work

鉃  work ng new ng-bazel-sample鈥--collection="@angular/bazel"
? Would you like to add Angular routing? No
? Which stylesheet format would you like to use? CSS
Schematic input does not validate against the Schema: {"name":"ng-bazel-sample鈥--collection=@angular/bazel","version":"8.0.3","routing":false,"style":"css"}
Errors:

  Data path ".name" should match format "html-selector".
鉃  work ng new ng-bazel-sample鈥--collection="@angular/bazel"
? Would you like to add Angular routing? No
? Which stylesheet format would you like to use? Sass   [ http://sass-lang.com/documentation/file.INDENTED_SYNTAX.html       ]
Schematic input does not validate against the Schema: {"name":"ng-bazel-sample鈥--collection=@angular/bazel","version":"8.0.3","routing":false,"style":"sass"}
Errors:

  Data path ".name" should match format "html-selector".

鉃  work ng new ng-bazel-sample鈥--collection=@angular/bazel
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? SCSS   [ http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax ]
Schematic input does not validate against the Schema: {"name":"ng-bazel-sample鈥--collection=@angular/bazel","version":"8.0.3","routing":true,"style":"scss"}
Errors:

  Data path ".name" should match format "html-selector".



鉃  work ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / 鈻 \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 8.0.3
Node: 10.14.1
OS: darwin x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.800.3
@angular-devkit/core         8.0.3
@angular-devkit/schematics   8.0.3
@schematics/angular          8.0.3
@schematics/update           0.800.3
rxjs                         6.4.0

following my macOS enviroment
macOS Mojave 10.14.5
MacBook Pro (Retina, 13-inch, Early 2015)

alan-agius4 added a commit to alan-agius4/angular that referenced this issue Jun 24, 2019

fix(bazel): remove unsupported Css pre-processors from ng new
Under Bazel, we don't yet support Stylus and Less, and thus we should not offer the users to generate applications which are known not to work.

Closes angular#31209

alan-agius4 added a commit to alan-agius4/angular that referenced this issue Jun 24, 2019

fix(bazel): remove unsupported Css pre-processors from ng new
Under Bazel, we don't yet support Stylus and Less, and thus we should not offer the users to generate applications which are known not to work.

Closes angular#31209
@henning96

This comment has been minimized.

Copy link
Author

commented Jun 24, 2019

Hi @alan-agius4,
I see. Is support for Less planned for the Angular 9 release? Or do we have to create our own Bazel rule for this?

@alan-agius4

This comment has been minimized.

Copy link
Contributor

commented Jun 24, 2019

@henning96, probably we will have a first party rule for Less, but there is no timeframe yet.

@alan-agius4

This comment has been minimized.

Copy link
Contributor

commented Jun 24, 2019

@gurezo, please file a new issue, your error is unrelated to Less.

@gurezo

This comment has been minimized.

Copy link

commented Jun 24, 2019

@alan-agius4 Okay!
i'll making to new issue

@kara kara closed this in e83667a Jun 24, 2019

kara added a commit that referenced this issue Jun 24, 2019

fix(bazel): remove unsupported Css pre-processors from ng new (#31234)
Under Bazel, we don't yet support Stylus and Less, and thus we should not offer the users to generate applications which are known not to work.

Closes #31209

PR Close #31234
@ManishJainGitHubUser

This comment has been minimized.

Copy link

commented Jul 9, 2019

Error getting Bazel info exit status 2
error setting higher file descriptor limit for this process: invalid argumentQuerying for files to watch...
INFO: Options provided by the client:
Inherited 'common' options: --isatty=0 --terminal_columns=80
INFO: Reading rc options for 'query' from /Users/user/ng8-bazel/bazeltest/.bazelrc:
Inherited 'common' options: --experimental_allow_incremental_repository_updates
ERROR: Unrecognized option: --experimental_allow_incremental_repository_updates
Bazel query failed: exit status 2
INFO: Options provided by the client:
Inherited 'common' options: --isatty=0 --terminal_columns=80
INFO: Reading rc options for 'query' from /Users/user/ng8-bazel/bazeltest/.bazelrc:
Inherited 'common' options: --experimental_allow_incremental_repository_updates
ERROR: Unrecognized option: --experimental_allow_incremental_repository_updates
Bazel query failed: exit status 2
Runing //src:devserver
INFO: Options provided by the client:
Inherited 'common' options: --isatty=0 --terminal_columns=80
INFO: Reading rc options for 'query' from /Users/user/ng8-bazel/bazeltest/.bazelrc:
Inherited 'common' options: --experimental_allow_incremental_repository_updates
ERROR: Unrecognized option: --experimental_allow_incremental_repository_updates
Error running Bazel exit status 2
/Users/user/ng8-bazel/bazeltest/node_modules/@bazel/ibazel/bin/darwin_amd64/ibazel failed with code 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.