I'm trying to build a container for a Typescript project.
When I execute the command, I face this error:
$ bazel run server
INFO: Analyzed target //:server (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //:server up-to-date:
bazel-bin/server-layer.tar
INFO: Elapsed time: 0.542s, Critical Path: 0.02s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
Loaded image ID: sha256:37e14ccf38dd12e60613d7c6c54902d85352cdef2efc6e19159b7cfb9f50dcc3
Tagging 37e14ccf38dd12e60613d7c6c54902d85352cdef2efc6e19159b7cfb9f50dcc3 as bazel:server
ERROR[runfiles.bash]: cannot look up runfile "nodejs_linux_amd64/bin/nodejs/bin/node" (RUNFILES_DIR="/app//server.binary.runfiles", RUNFILES_MANIFEST_FILE="")
>>>> FAIL: The node binary 'nodejs_linux_amd64/bin/nodejs/bin/node' not found in runfiles.
This node toolchain was chosen based on your uname 'Linux x86_64'.
Please file an issue to https://github.com/bazelbuild/rules_nodejs/issues if
you would like to add your platform to the supported rules_nodejs node platforms. <<<<
Please notice that:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?I have a demo repository to demonstrate the above error at https://github.com/danielepolencic/bazeltest
You can (try to) build the container with: bazel run server
I think I found the issue.
I'm on a Mac, but Docker for mac runs on Linux.
The command should be:
bazel run --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 server
Afaiu, Docker for Mac is required only if I want to run the image (of course). There is no dependency during the build.
I think the correct platform that should be used --platforms @build_bazel_rules_nodejs//toolchains/node:linux_amd64
See https://bazelbuild.github.io/rules_nodejs/install.html#cross-compilation
Most helpful comment
I think the correct platform that should be used
--platforms @build_bazel_rules_nodejs//toolchains/node:linux_amd64See https://bazelbuild.github.io/rules_nodejs/install.html#cross-compilation