Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Cannot find nodejs when running bazel run //src:devserver #469

Closed
ncgreco1440 opened this issue Jul 9, 2019 · 2 comments
Closed

Cannot find nodejs when running bazel run //src:devserver #469

ncgreco1440 opened this issue Jul 9, 2019 · 2 comments

Comments

@ncgreco1440
Copy link

ncgreco1440 commented Jul 9, 2019

I've cloned this repo and I added node_repositories to the list of loaded functions from @build_bazel_rules_nodejs//:defs.bzl so I could use vendored_node and vendored_yarn options. That's the only thing I've changed here and I get this error when trying to run the devserver.

no such target '@angular_bazel_example//:nodejs/node.exe':
target 'nodejs/node.exe' not declared in package ''; 
however, a source file of this name exists. 
(Perhaps add 'exports_files(["nodejs/node.exe"])' to /BUILD?)

Here what my node_repositories call looks like.

node_repositories(
    vendored_node = "@angular_bazel_example//:nodejs",
    vendored_yarn = "@angular_bazel_example//:yarn",
)

I've confirmed that the folder structure is sound. I have nodejs with what is essentially a copy/paste from Program Files, same with yarn. Bazel run @nodejs//:yarn works fine.

Taking a look at server artifacts, I can see [hash]/external/angular_bazel_example/nodejs/node.exe is available.

@ncgreco1440 ncgreco1440 changed the title Cannot find nodejs Cannot find nodejs when running bazel run //src:devserver Jul 9, 2019
@alexeagle
Copy link
Contributor

I think what the error message suggests is right. If you've vendored node.exe into your repo, you still need to expose it to be referenced from outside the Bazel package where it lives. That's what the exports_files does.

@alexeagle
Copy link
Contributor

Didn't hear back so I'll assume that solved your problem?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants