angular - 错误加载包'':每个.bzl文件必须有一个对应的包,但'@npm//:install_bazel_dependencies.bzl'没有
问题描述
我正在将 Bazel 集成到 Angular 应用程序中。但是在运行时ibazel run //src:devserver
我得到了这些错误:
iBazel [8:08AM]: Error getting Bazel info exit status 2
iBazel [8:08AM]: Querying for files to watch...
Loading: 0 packages loaded
ERROR: error loading package '': Every .bzl file must have a corresponding package, but '@npm//:install_bazel_dependencies.bzl' does not have one. Please create a BUILD file in the same or any parent directory. Note that this BUILD file does not need to do anything except exist.
Loading: 0 packages loaded
Loading: 0 packages loaded
iBazel [8:08AM]: Bazel query failed: exit status 7
Loading: 0 packages loaded
ERROR: error loading package '': Every .bzl file must have a corresponding package, but '@npm//:install_bazel_dependencies.bzl' does not have one. Please create a BUILD file in the same or any parent directory. Note that this BUILD file does not need to do anything except exist.
Loading: 0 packages loaded
Loading: 0 packages loaded
iBazel [8:08AM]: Bazel query failed: exit status 7
iBazel [8:08AM]: Running //src:devserver
Loading: 0 packages loaded
ERROR: error loading package '': Every .bzl file must have a corresponding package, but '@npm//:install_bazel_dependencies.bzl' does not have one. Please create a BUILD file in the same or any parent directory. Note that this BUILD file does not need to do anything except exist.
Loading: 0 packages loaded
Loading: 0 packages loaded
iBazel [8:08AM]: Error running Bazel exit status 7
在我看来,这似乎是一个问题
lodd("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
install_bazel_dependencies()
在我的WORKSPACE
文件中:
workspace(
name = "examples_angular",
managed_directories = {"@npm": ["node_modules"]},
)
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "2eca5b934dee47b5ff304f502ae187c40ec4e33e12bcbce872a2eeb786e23269",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.4.1/rules_nodejs-1.4.1.tar.gz"],
)
load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
yarn_install(
name = "npm",
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
install_bazel_dependencies()
load("@npm_bazel_protractor//:package.bzl", "npm_bazel_protractor_dependencies")
npm_bazel_protractor_dependencies()
load("@npm_bazel_karma//:package.bzl", "npm_bazel_karma_dependencies")
npm_bazel_karma_dependencies()
load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
web_test_repositories()
load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.2.bzl", "browser_repositories")
browser_repositories(
chromium = True,
firefox = True,
)
load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")
ts_setup_workspace()
那么我能做些什么呢?
devserver
我BUILD
文件中的目标:
ts_devserver(
name = "devserver",
additional_root_paths = ["src/example"],
entry_module = "examples_angular/src/main.dev",
scripts = [
"@npm//:node_modules/tslib/tslib.js",
":rxjs_umd_modules",
"@npm//date-fns:date-fns.umd.js",
],
static_files = _ASSETS + [
":inject_scripts_for_dev",
"//src/assets",
],
deps = ["//src"],
)
您可以通过克隆来重现错误:https ://github.com/flolu/cents-ideas/tree/3ad56108507ee77f0b8a072e9c204c32d5c9ebdc并运行ibazel run //src:devserver
./services/angular
解决方案
刚刚检查了你的仓库,这个命令对我很有用。
也许尝试这样做bazel clean --expunge
并在那之后重复。
推荐阅读
- python - 没有出现在 Tensorflow-PyCharm IDE 中的可视化
- excel - VBA 或 Excel 函数计算逗号分隔字符串中的非零
- python - Raspberry Pi Google Assistant 上的 Google 自定义设备操作给出错误
- python - ATM SCRIPT CODIO - 试图理解我的错误。任何见解将不胜感激
- python - 使用逗号分隔的输入检查嵌套列表
- stanford-nlp - 向量空间模型 - 计算出查询向量 [0, 0.707, 0.707]
- javascript - spyOn 静态方法 - Jasmine ES6
- javascript - 无法在前端访问烧瓶 @login-required API
- mysql - Apache 日志文件中的奇怪引用:空字符串和看起来像 MySQL 代码的内容
- java - 将对象添加到 ArrayList 时,已在列表中的具有 ArrayList 作为属性的其他对象被修改?