繁体   English   中英

error loading package '': 每个 .bzl 文件都必须有一个对应的包,但是 '@npm//:install_bazel_dependencies.bzl' 没有

[英]error loading package '': Every .bzl file must have a corresponding package, but '@npm//:install_bazel_dependencies.bzl' does not have one

我正在将 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()

那么我能做些什么呢?


我的BUILD文件中的devserver目标:

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

刚刚检查了你的 repo,这个命令对我很有用。

也许尝试做bazel clean --expunge并在此之后重复。

暂无
暂无

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

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