簡體   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