简体   繁体   English

Angular - 添加 Bazel 不会创建 WORKSPACE 或 BUILD 文件

[英]Angular - Adding Bazel Won't Create WORKSPACE or BUILD File

I've just created a new Angular Application by running ng new name After this finished I ran (as described in the documentation: https://angular.io/guide/bazel )我刚刚通过运行ng new name创建了一个新的 Angular 应用程序完成后我运行了(如文档中所述: https://angular.io/guide/bazel

ng add @angular/bazel

to add Bazel to my project.将 Bazel 添加到我的项目中。

But after this command finished, there is no WORKSPACE file or any BUILD file in my project.但是在这个命令完成后,我的项目中没有WORKSPACE文件或任何BUILD文件。 I am relatively new to Bazel, but I am sure that those files should be there?!我对 Bazel 比较陌生,但我确定那些文件应该在那里?!

目录

What is also strange is that when running ng add @angular/bazel , I often get this error:同样奇怪的是,当运行ng add @angular/bazel时,我经常会得到这个错误:

An unhandled exception occurred: npm WARN npm npm does not support Node.js v10.15.2
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN tar write after end
npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/flo/.npm/_logs/2020-02-13T09_42_26_044Z-debug.log
Package install failed, see above.
See "/tmp/ng-3enaGH/angular-errors.log" for further details.

By default, the WORKSPACE and BUILD.bazel are only created when needed - during a build or when ng serve is running.默认情况下,WORKSPACE 和 BUILD.bazel 仅在需要时创建 - 在构建期间或 ng serve 运行时。

See the advanced section in the document you referenced above for how to change the defaults:请参阅您上面引用的文档中的高级部分,了解如何更改默认值:

ng build --leaveBazelFilesOnDisk

For your second question, I had to upgrade node+angular to the latest LTS version before it worked for me.对于你的第二个问题,我必须先将 node+angular 升级到最新的 LTS 版本,然后它才能为我工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM