Skip to content

README config example breaks when copied into ~/.nodeenvrc #422

Description

@ekalinin

The Configuration section of README.rst lists the options with Python-style values:

[nodeenv]
node = 'latest'
npm = 'latest'
with_npm = False
jobs = '2'
...
make = 'make'
...
mirror = None

Config._load reads the file with ConfigParser.get, which returns the raw string, so the quotes become part of the value. Copied into ~/.nodeenvrc, five of the fifteen lines change the option:

Line in README Value nodeenv gets
node = 'latest' "'latest'"
npm = 'latest' "'latest'"
jobs = '2' "'2'"
make = 'make' "'make'"
mirror = None 'None'

The boolean lines are fine, because getboolean accepts True and False.

Reproduce

On master (e745358):

$ printf "[nodeenv]\nnode = 'latest'\n" > quoted.ini
$ nodeenv -C quoted.ini env
...
ValueError: invalid literal for int() with base 10: "'latest'"

$ printf "[nodeenv]\nmirror = None\n" > mirror.ini
$ nodeenv -C mirror.ini --node=22.11.0 env
 * Install prebuilt node (22.11.0) .Error: cannot download https://None/download/release/v22.11.0/node-v22.11.0-darwin-arm64.tar.gz: [Errno 8] nodename nor servname provided, or not known

Where it comes from

The block was added in ac9a510 ("Add ability to configure mirror through setting file"). nodeenv --dump-config-defaults, whose docstring says it prints the defaults for the README, now prints the values without quotes, but it still prints mirror = None.

Possible fix

Regenerate the block from --dump-config-defaults, and leave mirror out of it or show it commented out, since it has no default.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation changes

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions