Closed qaiffluke closed 5 years ago
In general you should be using the released versions as follows: load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive( name = "io_bazel_rules_webtesting", sha256 = "f1f4d2c2f88d2beac64c82499a1e762b037966675dd892da89c87e39d72b33f6", urls = [ "https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.2/rules_webtesting.tar.gz", ], )
load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
web_test_repositories()
Otherwise you will need the go dependencies (the released version includes precompiled binaries).
Having the same problem as @qaiffluke. Following @DrMarcII's advice does not resolve this for me. Is there an order in which the http_archive, load, and web_test_repositories() must appear within the WORKSPACE file for this to work properly?
Following the advice @DrMarcII gave, worked for me. But I've been getting a new error instead:
ERROR: error loading package '': in C:/users/bazel_user/external/npm_bazel_typescript/defs.bzl: in C:/users/bazel_user/external/npm_bazel_typescript/internal/build_defs.bzl: in C:/
users/bazel_user/external/npm_bazel_typescript/internal/common/compilation.bzl: Unable to load file '@build_bazel_rules_nodejs//:declaration_provider.bzl': file doesn't exist
ERROR: error loading package '': in C:/users/bazel_user/external/npm_bazel_typescript/defs.bzl: in C:/users/bazel_user/external/npm_bazel_typescript/internal/build_defs.bzl: in C:/
users/bazel_user/external/npm_bazel_typescript/internal/common/compilation.bzl: Unable to load file '@build_bazel_rules_nodejs//:declaration_provider.bzl': file doesn't exist
Here's my WORKSPACE File for reference:
# The WORKSPACE file tells Bazel that this directory is a "workspace", which is like a project root.
# The content of this file specifies all the external dependencies Bazel needs to perform a build.
####################################
# ESModule imports (and TypeScript imports) can be absolute starting with the workspace name.
# The name of the workspace should match the npm package where we publish, so that these
# imports also make sense when referencing the published package.
workspace(
name = "lopez_ui",
managed_directories = {"@npm": ["node_modules"]},
)
# These rules are built-into Bazel but we need to load them first to download more rules
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Fetch rules_nodejs so we can install our npm dependencies
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "3356c6b767403392bab018ce91625f6d15ff8f11c6d772dc84bc9cada01c669a",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.36.1/rules_nodejs-0.36.1.tar.gz"],
)
# Fetch sass rules for compiling sass files
http_archive(
name = "io_bazel_rules_sass",
sha256 = "4f05239080175a3f4efa8982d2b7775892d656bb47e8cf56914d5f9441fb5ea6",
strip_prefix = "rules_sass-86ca977cf2a8ed481859f83a286e164d07335116",
url = "https://github.com/bazelbuild/rules_sass/archive/86ca977cf2a8ed481859f83a286e164d07335116.zip",
)
# Fetch webtest rules
http_archive(
name = "io_bazel_rules_webtesting",
sha256 = "f1f4d2c2f88d2beac64c82499a1e762b037966675dd892da89c87e39d72b33f6",
urls = [
"https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.2/rules_webtesting.tar.gz",
],
)
# Check the bazel version and download npm dependencies
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "yarn_install", "node_repositories")
# Bazel version must be at least the following version because:
# - 0.27.0 Adds managed directories support
check_bazel_version(
message = """
You no longer need to install Bazel on your machine.
Angular has a dependency on the @bazel/bazel package which supplies it.
Try running `yarn bazel` instead.
(If you did run that, check that you've got a fresh `yarn install`)
""",
minimum_bazel_version = "0.27.0",
)
# Setup the Node.js toolchain & install our npm dependencies into @npm
yarn_install(
name = "npm",
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)
node_repositories(
package_json = ["//:package.json"]
)
# Install all bazel dependencies of our npm packages
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
install_bazel_dependencies()
# Load npm_bazel_protractor dependencies
load("@npm_bazel_protractor//:package.bzl", "npm_bazel_protractor_dependencies")
npm_bazel_protractor_dependencies()
# Load npm_bazel_karma dependencies
load("@npm_bazel_karma//:package.bzl", "rules_karma_dependencies")
rules_karma_dependencies()
# Setup the rules_webtesting toolchain
load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
web_test_repositories()
# Temporary work-around for https://github.com/angular/angular/issues/28681
# TODO(gregmagolan): go back to @io_bazel_rules_webtesting browser_repositories
load("@npm_bazel_karma//:browser_repositories.bzl", "browser_repositories")
browser_repositories()
# Setup the rules_typescript tooolchain
load("@npm_bazel_typescript//:defs.bzl", "ts_setup_workspace")
ts_setup_workspace()
# Setup the rules_sass toolchain
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
sass_repositories()
################################
# Support for Remote Execution #
################################
http_archive(
name = "bazel_toolchains",
sha256 = "88e818f9f03628eef609c8429c210ecf265ffe46c2af095f36c7ef8b1855fef5",
strip_prefix = "bazel-toolchains-92dd8a7",
urls = [
"https://github.com/bazelbuild/bazel-toolchains/archive/92dd8a7.zip",
],
)
####################################################
# Support creating Docker images for our node apps #
####################################################
http_archive(
name = "io_bazel_rules_docker",
sha256 = "aed1c249d4ec8f703edddf35cbe9dfaca0b5f5ea6e4cd9e83e99f3b0d1136c3d",
strip_prefix = "rules_docker-0.7.0",
urls = ["https://github.com/bazelbuild/rules_docker/archive/v0.7.0.tar.gz"],
)
load("@io_bazel_rules_docker//nodejs:image.bzl", nodejs_image_repos = "repositories")
nodejs_image_repos()
# ####################################################
# # Kubernetes setup, for deployment to Google Cloud #
# ####################################################
# git_repository(
# name = "io_bazel_rules_k8s",
# commit = "36ae5b534cc51ab0815c9bc723760469a9f7175c",
# remote = "https://github.com/bazelbuild/rules_k8s.git",
# shallow_since = "1545317854 -0500",
# )
# load("@io_bazel_rules_k8s//k8s:k8s.bzl", "k8s_defaults", "k8s_repositories")
# k8s_repositories()
# k8s_defaults(
# # This creates a rule called "k8s_deploy" that we can call later
# name = "k8s_deploy",
# # This is the name of the cluster as it appears in:
# # kubectl config view --minify -o=jsonpath='{.contexts[0].context.cluster}'
# cluster = "_".join([
# "gke",
# "internal-200822",
# "us-west1-a",
# "lopez-ui",
# ]),
# kind = "deployment",
# )
I don't understand what is wrong. I've been following the angular-bazel-example for reference. Can you help me understand the problem here? Thank you!
I'm a newbie at Bazel and everything was working fine until only recently have I come across this problem. Any help would be appreciated.
I have tried the following workaround too:
But it gives me the same error. However, if I move it before loading the
rules_karma_dependencies
, it wants me to include the go_dependencies which I do not need.All suggestions are welcome and please let me know if this is the right place to report this or someplace else. Thank you!!