bazelbuild / rules_nodejs

NodeJS toolchain for Bazel.

Home Page:https://bazelbuild.github.io/rules_nodejs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: nodejs_binary doesn't set up its node_modules hermetically

JeffFaer opened this issue · comments

What happened?

JeffFaer/playground@7812bd9

If I run a nodejs_binary, it doesn't seem to have the right node_modules setup

$ bazel run :eslint_sh -- --fix --ext js ${PWD}/foo.js            
...
Oops! Something went wrong! :(

ESLint: 8.22.0

ESLint couldn't find the config "google" to extend from. Please check that the name of the config is correct.

The config "google" was referenced from the config file in "/usr/local/google/home/jfalgout/git/playground/rules_nodejs/NODE_PATH/.eslintrc.yml".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

but if I invoke the nodejs_binary shell script with a different NODE_PATH, everything works:

$ cat eslint_wrapper.sh
...
eslint="${PWD}/$1"
shift

# Call eslint with a $0 it can use.
NODE_PATH="${PWD}/external/npm/node_modules" bash -c "source \"${eslint}\"" "$0" "$@"

$ bazel run //:eslint_sh -- --fix --ext js "${PWD}/foo.js"
(works just fine)

Version

Development (host) and target OS/architectures:

$ uname -a
Linux <host> 5.19.11-1rodete1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.19.11-1rodete1 (2022-10-31) x86_64 GNU/Linux

Output of bazel --version: 6.0.0

Version of rules_nodejs, or other relevant rules from your
WORKSPACE or MODULE.bazel file: 5.8.0

node 16.13.2 (although the problem reproduces even if I remove that specific version)

Language(s) and/or frameworks involved:

How to reproduce

Check out and run the commands from https://github.com/JeffreyFalgout/playground/commit/7812bd97674bf647df8a91a363f234e271e442fc

Any other information?

No response

rules_nodejs doesn't have any active maintainers currently so your issue is not likely to be addressed. I recommend using rules_js instead which includes a complete re-write of the linker that should solve this problem.

I recommend using rules_js instead which includes a complete re-write of the linker that should solve this problem.

I was just about to ask that. I'll give it a shot and circle back :)

This issue has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs in 30 days. Note as of rules_nodejs v6 the rules_nodejs repository contains only the core nodejs toolchain and @bazel/runfiles package. All rulesets are removed and unmaintained. For alternate rulesets suggestions include https://github.com/aspect-build/rules_js, https://github.com/aspect-build/rules_ts Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs!

This issue was automatically closed because it went 30 days without any activity since it was labeled "Can Close?"