You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How did you install nvm? (e.g. install script in readme, homebrew):
Unsure
What steps did you perform?
nvm install lts/boron, after running "set -e" in the shell.
What happened?
nvm install displayed nvm_ensure_default_set: a version is required and exited with non-zero status.
What did you expect to happen?
The lts/boron version should have been installed and nvm install should have exited with zero status.
Is there anything in any of your profile files (.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?
No.
More analysis:
I ran "nvm install lts/boron" in a Bash script with set -e and set -x. I traced through the "nvm install lts/boron" output, following along in the source of the nvm shell function. I discovered a bug in the nvm install command.
When you choose install an lts version, it sets the internal "provided_version" variable to the empty string.
At the end of the install command, it runs nvm_ensure_default_set "$provided_version". This fails with an error message, "nvm_ensure_default_set: a version is required", which we see in the output, and causes that function to return 1.
Because the script is being executed with "set -e", when nvm_ensure_default_set returns 1, it is considered an error and the script exits.
To reproduce, uninstall lts/boron, then install it with set -e enabled, and check that the exit status is 1, whereas if you uninstall it and install it again with set -e disabled, the exit status is zero (the error message is displayed in either case).
The workaround is to use nvm install v6.9.5, which is the version lts/boron actually maps to. This avoids the bug in nvm install, so provided_version remains set, and nvm_ensure_default_set succeeds, and the script exits with status 0 even with set -e.
The text was updated successfully, but these errors were encountered:
Operating system and version: Linux
nvm debug
output:nvm ls
output:nvm
? (e.g. install script in readme, homebrew):Unsure
nvm install lts/boron, after running "set -e" in the shell.
nvm install displayed
nvm_ensure_default_set: a version is required
and exited with non-zero status.The lts/boron version should have been installed and nvm install should have exited with zero status.
.bashrc
,.bash_profile
,.zshrc
, etc) that modifies thePATH
?No.
I ran "nvm install lts/boron" in a Bash script with set -e and set -x. I traced through the "nvm install lts/boron" output, following along in the source of the nvm shell function. I discovered a bug in the nvm install command.
To reproduce, uninstall lts/boron, then install it with set -e enabled, and check that the exit status is 1, whereas if you uninstall it and install it again with set -e disabled, the exit status is zero (the error message is displayed in either case).
The workaround is to use
nvm install v6.9.5
, which is the version lts/boron actually maps to. This avoids the bug in nvm install, so provided_version remains set, and nvm_ensure_default_set succeeds, and the script exits with status 0 even with set -e.The text was updated successfully, but these errors were encountered: