Skip to content

Error creating application with @angular/bazel #33710

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fabriziodebortoli opened this issue Nov 8, 2019 · 12 comments
Closed

Error creating application with @angular/bazel #33710

fabriziodebortoli opened this issue Nov 8, 2019 · 12 comments
Labels
area: bazel Issues related to the published `@angular/bazel` build rules needs: clarification This issue needs additional clarification from the reporter before the team can investigate. needs reproduction This issue needs a reproduction in order for the team to investigate further type: bug/fix

Comments

@fabriziodebortoli
Copy link

🐞 Bug report

I would like to try Angular with Bazel following the instructions of the page https://next.angular.io/guide/bazel but I have errors both during the ng new and during the ng build

Command (mark with an x)

- [x] new
- [x] build

Description

ng new --collection=@angular/bazel throws an error

EDIT: After installing @angular/bazel package, also ng build throws an ERROR

🔬 Minimal Reproduction

npm i -g @angular/cli@next @angular/bazel@next

ng new --collection=@angular/bazel

🔥 Exception or Error


An unhandled exception occurred: Cannot find module '@angular-devkit/schematics'
Require stack:
- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\bazel\src\schematics\ng-new\index.js
- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\export-ref.js
- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\index.js
- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\utilities\json-schema.js
- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\models\command-runner.js
- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\cli\index.js
- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
- C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
See "C:\Users\Admin\AppData\Local\Temp\ng-2XKNxH\angular-errors.log" for further details.

🌍 Your Environment


Angular CLI: 9.0.0-rc.1
Node: 12.13.0
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.900.0-rc.1
@angular-devkit/core         9.0.0-rc.1
@angular-devkit/schematics   9.0.0-rc.1
@schematics/angular          9.0.0-rc.1
@schematics/update           0.900.0-rc.1
rxjs                         6.5.3

Anything else relevant?
I tried to do

ng new bazel-project
# and
ng add @angular/bazel

but with this output:


Installing packages for tooling via npm.
An unhandled exception occurred: spawnSync npm ENOENT
Package install failed, see above.
See "C:\Users\Admin\AppData\Local\Temp\ng-j3oYip\angular-errors.log" for further details.

EDIT: `ng add @angular/bazel' throws an error but will be solved with angular/angular-cli#16112

@alan-agius4
Copy link
Contributor

The second issue is the same as angular/angular-cli#16115 and will be solved with angular/angular-cli#16112

@fabriziodebortoli
Copy link
Author

fabriziodebortoli commented Nov 8, 2019

The second issue is the same as angular/angular-cli#16115 and will be solved with angular/angular-cli#16112

I confirm, I applied locally angular/angular-cli#16112 and after ng add @angular/bazel returns Packages installed successfully.

Now, I'm trying ng build --leaveBazelFilesOnDisk but with thisoutput:


INFO: Call stack for the definition of repository 'npm' which is a npm_install (rule definition at C:/users/debortoli/_bazel_debortoli/lnul7bey/external/build_bazel_rules_nodejs/internal/npm_install/npm_install.bzl:298:15
):
 - C:/users/debortoli/_bazel_debortoli/lnul7bey/external/build_bazel_rules_nodejs/index.bzl:77:5
 - C:/microarea/bazel/WORKSPACE:64:1
ERROR: An error occurred during the fetch of repository 'npm':
   npm_install failed:
> [email protected] postinstall C:
g-proj\bazel
> ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points

 (npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, scandir 'C:
g-proj\bazel\node_modules\webpack-dev-server\node_modules\fsevents\node_modules'
The system cannot find the path specified.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Admin\AppData\Roaming\npm-cache\_logs\2019-11-08T13_04_26_484Z-debug.log
)
ERROR: no such package '@npm//': npm_install failed:
> [email protected] postinstall C:
g-proj\bazel
> ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points

 (npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, scandir 'C:
g-proj\bazel\node_modules\webpack-dev-server\node_modules\fsevents\node_modules'
The system cannot find the path specified.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Admin\AppData\Roaming\npm-cache\_logs\2019-11-08T13_04_26_484Z-debug.log
)
ERROR: no such package '@npm//': npm_install failed:
> [email protected] postinstall C:
g-proj\bazel
> ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points

 (npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, scandir 'C:
g-proj\bazel\node_modules\webpack-dev-server\node_modules\fsevents\node_modules'
The system cannot find the path specified.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Admin\AppData\Roaming\npm-cache\_logs\2019-11-08T13_04_26_484Z-debug.log
)
INFO: Elapsed time: 13.765s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
C:
g-proj\bazel\node_modules\@bazel\bazel\node_modules\@bazel\bazel-win32_x64\bazel-0.28.1-windows-x86_64.exe failed with code 1.

@alan-agius4 alan-agius4 transferred this issue from angular/angular-cli Nov 9, 2019
@alan-agius4 alan-agius4 added the area: bazel Issues related to the published `@angular/bazel` build rules label Nov 9, 2019
@ngbot ngbot bot added this to the needsTriage milestone Nov 9, 2019
@manklu
Copy link

manklu commented Nov 9, 2019

@fabriziodebortoli From my limited experience it works better with yarn.

bazel-0.28.1-windows-x86_64.exe failed with code 1.

Is the Visual C++ Redistributable for Visual Studio 2015 installed on your machine?
See https://docs.bazel.build/versions/1.1.0/install-windows.html

And you will need Bash. You can either install MSYS2 or use the executable from Git.

@IgorMinar
Copy link
Contributor

I can't reproduce this with 9.0.0-rc.1 on mac.

But let's assume that the first part of this issue should be resolved by the next rc version of the CLI via angular/angular-cli#16112.

The second part seems to be related to invoking ngcc during npm postinstall.

can you try running npm install in the project folder and report any errors?

@fabriziodebortoli
Copy link
Author

The second part seems to be related to invoking ngcc during npm postinstall.

can you try running npm install in the project folder and report any errors?

npm install completed successfully with no errors.
But ng build error remains

@fabriziodebortoli
Copy link
Author

@fabriziodebortoli From my limited experience it works better with yarn.

I tried:

rimraf node_modules

yarn install # Completed successfully

ng build

with output:


ERROR: error loading package '': Unable to load file '@io_bazel_rules_webtesting//web/versioned:browsers-0.3.2.bzl': file doesn't exist
ERROR: error loading package '': Unable to load file '@io_bazel_rules_webtesting//web/versioned:browsers-0.3.2.bzl': file doesn't exist
INFO: Elapsed time: 75.143s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
C:\Microarea\bazel\node_modules\@bazel\bazel-win32_x64\bazel-0.28.1-windows-x86_64.exe failed with code 1.

@JiaLiPassion
Copy link
Contributor

@fabriziodebortoli, I met the same issue before,
could you try.

yarn bazel clean --expunge
rimraf node_modules

then build again.

@IgorMinar
Copy link
Contributor

I can't reproduce this on mac with 9.0.0-rc.2 any more. Does the issue reproduce for you?

Steps I used:

yarn global add @angular/cli@next @angular/bazel@next
ng new --collection=@angular/bazel bazel-v9-test
cd bazel-v9-test
yarn ng serve

@IgorMinar IgorMinar added needs reproduction This issue needs a reproduction in order for the team to investigate further and removed severity5: ivy-compat labels Nov 19, 2019
@JiaLiPassion
Copy link
Contributor

I can reproduce this one with 9.0.0-rc.2 for both @angular/cli and @angular/bazel, but it seems the issue has been fixed in 9.0.0-rc.5.

@fridoo
Copy link

fridoo commented Dec 13, 2019

I also got @fabriziodebortoli build error when adding @angular/bazel to an existing project like this.

ng new bazel-add-test --defaults
cd bazel-add-test
ng add @angular/bazel
ng build
Starting local Bazel server and connecting to it...
ERROR: error loading package '': Unable to load file '@io_bazel_rules_webtesting//web/versioned:browsers-0.3.2.bzl': file doesn't exist
ERROR: error loading package '': Unable to load file '@io_bazel_rules_webtesting//web/versioned:browsers-0.3.2.bzl': file doesn't exist
INFO: Elapsed time: 34.122s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
/Users/fridoo/SoftwareProjects/test/bazel-add-test/node_modules/@bazel/bazel-darwin_x64/bazel-0.28.1-darwin-x86_64 failed with code 1.

What worked was using ng add @angular/bazel@next instead of ng add @angular/bazel

@jelbourn jelbourn added the needs: clarification This issue needs additional clarification from the reporter before the team can investigate. label Oct 1, 2020
@petebacondarwin
Copy link
Contributor

It sounds from #33710 (comment) that this has been solved. On top of that the bazel Angular package is deprecated.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: bazel Issues related to the published `@angular/bazel` build rules needs: clarification This issue needs additional clarification from the reporter before the team can investigate. needs reproduction This issue needs a reproduction in order for the team to investigate further type: bug/fix
Projects
None yet
Development

No branches or pull requests

8 participants