-
-
Notifications
You must be signed in to change notification settings - Fork 8k
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
source nvm.sh; nvm install --lts fails #1664
Comments
The first option is the proper workaround; setting shell options is hostile to other things that run in the same shell. The second option isn’t an option. The third option, however, is a fine longer-term fix. Thanks! |
There your pull-request goes. If it's alright, I've also added |
In tests, we don't worry about local foo
foo=1 to account for ksh. |
Great :-), then feel free to merge #1665 at some point. Wish you a great weekend! |
Closed in #1665. |
…le_20171115 Fix #1664: unassigned variable
Hi @norpol , I wondered how your script works, you are sourcing and installing node inside a script. But the parent shell does not have node installed. This is the script I tried to run #!/bin/bash
setup_nvm() {
export NVM_DIR="${HOME}/.nvm"
export NODE_VERSION=6.11.5
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
. "${NVM_DIR}/nvm.sh"
nvm list
nvm install ${NODE_VERSION}
nvm use ${NODE_VERSION}
nvm alias default ${NODE_VERSION}
npm install -g grunt
}
setup_nvm I can see them installed correctly. But when I type |
@liqiang372 You have to re-source nvm.sh in your parent shell after doing that, if you're doing that in a script. Also, you don't need the |
@ljharb got it, thanks! So there is no ultimate automation of this installation. I have to at last run $ . ~/.nvm/nvm.sh by myself to make current shell aware of the change |
Yes, that's correct. |
Fixes - fix unassigned variable (nvm-sh#1665, nvm-sh#1664) - Fix for $path used by zsh (nvm-sh#1669) - `set -u`: ensure `NVM_USE_OUTPUT` is always set (nvm-sh#1671) - `install.sh`: Fix a bug that block that installation of node in install.sh (nvm-sh#1676) - `nvm install-latest-npm`: fix node 4-4.6 Documentation - Make `nvm cache clear` message less ambiguous (nvm-sh#1644) - Added missing piece (nvm-sh#1658)
…variable_20171115 Fix nvm-sh#1664: unassigned variable
Fixes - fix unassigned variable (nvm-sh#1665, nvm-sh#1664) - Fix for $path used by zsh (nvm-sh#1669) - `set -u`: ensure `NVM_USE_OUTPUT` is always set (nvm-sh#1671) - `install.sh`: Fix a bug that block that installation of node in install.sh (nvm-sh#1676) - `nvm install-latest-npm`: fix node 4-4.6 Documentation - Make `nvm cache clear` message less ambiguous (nvm-sh#1644) - Added missing piece (nvm-sh#1658)
Hi, short overview is that
set -u
in a script is letting mynvm install --lts
fail, due obvious reasons.A quick response would is super welcomed.
I get the error message:
NVM_LS_REMOTE_IOJS_OUTPUT: parameter not set
.This happens, because I'm using
set -u
in my script. I'd like to have a very quick conversation regards how we should resolve the issue:set +u; setup_nvm; set -u
in my script)How should this be handled in our code? Should we getset -eu
enabled by default insidenvm
?NVM_LS_REMOTE_IOJS_OUTPUT
is assigned outside the condition above. https://github.com/creationix/nvm/blob/master/nvm.sh#L525The text was updated successfully, but these errors were encountered: