-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
Installs Node.js and ends the setup process automatically #549
Conversation
Just a note: I looked at the build report and couldn't figure out why it did fail. |
Sometimes the tests time out; I'll rerun that one. I'm pretty hesitant to add extra features to the (mostly untested) install script just to cover people that don't read the instructions. The install script installs nvm - I'm not sure why you'd have an expectation that it would install anything else? |
Well... The whole purpose of NVM is to have Node.js installed, it seems 😉 Anyway, users don't read the instructions, whether they are developers or not... hard truth, but truth nonetheless. |
I also don't think we can presume that "stable" is the thing the user wants to install - nor that the user necessarily wants the install script to make a network call or compile something. Think setup for automated test environments, for example. |
You are absolutely right. This is a very good example of why the PR makes the installed version customizable via the I imagined it could be used just the same as NVM already does to select the correct test suite in Travis (https://github.com/creationix/nvm/blob/master/.travis.yml#L12-L31). Maybe the PR could be turned upside down: The default behaviour of NVM being left unchanged but the presence of the |
That's not a bad idea. |
Done :) |
I kinda agree with @xcambar in that the main purpose of NVM is to get a NodeJS binary up and running and a given environment. My 2 cents. |
Sure, but this is the install script - it's main purpose is to get |
@@ -48,6 +51,17 @@ install_nvm_from_git() { | |||
return | |||
} | |||
|
|||
install_node() { | |||
# Sourcing $PROFILE to take into account the new environment | |||
source $PROFILE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to re-source the entire $PROFILE, or would sourcing $NVM_DIR/nvm.sh
be sufficient?
I've followed your comments. |
@@ -126,6 +146,11 @@ else | |||
else | |||
echo "=> Source string already in $PROFILE" | |||
fi | |||
# Automatically install Node.js | |||
if [ -z "$NODE_VERSION" ]; then | |||
echo "=> Close and reopen your terminal to start using nvm" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this actually necessary? Doesn't nvm
execute hash -r
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only on "use" or "deactivate" - but what might be helpful here is to actually source nvm
, rather than relying on the profile to do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...source nvm, rather than relying on the profile to do it?
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 too, but as it was the former behaviour of the install script, it felt out of scope to remove it without notice.
As we seem to agree on it, I'll add the source
.
Done. Note that the |
Please rebase this on top of master - it's currently not mergeable. |
Will do in the next few days. Sounds good ? |
@xcambar do you still have any interest in completing this PR? |
8aae2c5
to
f1af1c1
Compare
Rebased and well. |
@@ -42,8 +42,8 @@ or Wget: | |||
|
|||
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).</sub> | |||
|
|||
You can customize the install source, directory and profile using the `NVM_SOURCE`, `NVM_DIR`, and `PROFILE` variables. | |||
Eg: `curl ... | NVM_DIR="path/to/nvm" bash` | |||
You can customize the install source, directory, profile and version using the `NVM_SOURCE`, `NVM_DIR`, `PROFILE` and `NODE_VERSION` variables. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add an Oxford comma after "profile" and PROFILE
local CURRENT_NVM_NODE | ||
|
||
CURRENT_NVM_NODE="$(nvm_version current)" | ||
if [ "$(nvm_version $NODE_VERSION)" == "$CURRENT_NVM_NODE" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NODE_VERSION needs quotes here
LGTM pending the above comments |
f1af1c1
to
35fa736
Compare
fi | ||
|
||
echo "=> Installing Node.js version $NODE_VERSION" | ||
nvm install $NODE_VERSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this var needs quotes
35fa736
to
f5724e4
Compare
@@ -255,9 +286,13 @@ nvm_do_install() { | |||
fi | |||
fi | |||
|
|||
# Sourcing $PROFILE to take into account the new environment | |||
source $NVM_PROFILE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, one more - this needs to be quoted, and it must use .
since source
isn't as portable
f5724e4
to
a24ff3e
Compare
Thanks! |
Many people around me don't read enough of the README and expect Node.js to be installed after running the install script.
Based on a Gist I've written for my coworkers (https://gist.github.com/xcambar/2f88b912b7d40fe605c5), we thought it could be beneficial to NVM that the install script actually installs Node.js.
This is what this PR does, with a configurable Node.js version (defaulting to
stable
).