Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: On bzlmod version use_home_npmrc doesn't check for file existence #2068

Open
niconatalie opened this issue Jan 14, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@niconatalie
Copy link

niconatalie commented Jan 14, 2025

What happened?

From the documentation the use_home_npmrc should only be parsed if it exists

Use the $HOME/.npmrc file (or $USERPROFILE/.npmrc when on Windows) if it exists.

On the bzlmod version, it doesn't check for file existence and causing Error in read: java.io.FileNotFoundException: /home/myhome/.npmrc (No such file or directory) error

home_npmrc = parse_npmrc(module_ctx.read(home_npmrc_path))

Here is the version of non-bzlmod and it checks for file existence

is_windows = repo_utils.is_windows(rctx)
if is_windows or utils.exists(rctx, home_npmrc_path):
_load_npmrc(priv, rctx, home_npmrc_path)

Version

Development (host) and target OS/architectures:

Output of bazel --version:
7.4.1

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

aspect_rules_js v2.1.2

Language(s) and/or frameworks involved:

How to reproduce

Use bzlmod and enable `use_home_npmrc` flag

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True)
npm.npm_translate_lock(
   use_home_npmrc = True,
)

Any other information?

No response

@niconatalie niconatalie added the bug Something isn't working label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant