nodejs / nodejs/node-gyp

dist-url option in environment variable not working as expected

Open
#2,250 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.7k
Forks
1.9k
Avg merge
1d 4h
Merged PRs (30d)
5

Description

  • Node Version: node v14.14.0, npm v6.14.8
  • Platform: Darwin
  • Compiler: Apple clang version 12.0.0 (clang-1200.0.32.2)
  • Module: robotjs (does not really matter)

The document says:

Use the form npm_config_OPTION_NAME for any of the command options listed above (dashes in option names should be replaced by underscores).

But dist-url does not work this way:

export npm_config_dist_url=xxx

because what we get from the above is gyp.opts.dist_url but the code is using other forms:

https://github.com/nodejs/node-gyp/blob/66c0f0446749caa591ad841cd029b6d5b5c8da42/lib/process-release.js#L22

However it works when keeping or removing the dash:

# environment variable with dash is not valid to export
$ env npm_config_dist-url=xxx node-gyp

Should dist_url also be supported as described in the document? Thanks.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/process-release.js at the linked reference and compare its option lookup with the documented npm_config_DIST option naming. Reproduce the behavior using the provided environment-variable examples, then verify that the underscore form is handled consistently with the documentation. No test file is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js
Domain
cli, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.