-
-
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
How to update nvm #400
Comments
I always install by cloning from git. Then if I want to update, I simply do a git pull. That said, why would you upgrade if it's working? Personally I've never upgraded nvm after installing it on a machine. (though my operating system install lifetimes are fairly short). If you learn about a new feature that you need, then git pull and you're done. Remember that every feature added has a cost. Could you explain what exactly makes it more awesome? Perhaps I'm not understanding your use case. |
Duplicate of #127 |
Also, you don't have to ever remove |
I feel #127 shouldn't be closed now that users are not supposed to run from master but from a tagged commit. I use the following script: #!/bin/sh
set -e
cd ~/.nvm
git fetch --tags
TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Checking out tag $TAG..."
git checkout "$TAG"
source ~/.nvm/nvm.sh |
+1 |
1 similar comment
+1 |
It appears that simply effectively re-installing over an existing nvm actually updates it. This would be a really trivial script. |
I believe this should do it. The #!/bin/sh
download() {
if which curl > /dev/null; then
curl -s $@
else
wget -qO- $@
fi
}
download https://raw.githubusercontent.com/creationix/nvm/v0.20.0/install.sh | /usr/bin/env bash $@ Or, if you'd prefer a giant one-liner, here it is. This one should also work with #!/bin/sh
`which curl > /dev/null && printf 'curl -s' || printf 'wget -qO-'` https://raw.githubusercontent.com/creationix/nvm/v0.20.0/install.sh | /usr/bin/env bash $@ Both have been tested in If you want to add support for using Git, it'll take bit more logic and a lot of Git "plumbing" commands, such as Maybe that could be put into nvm.sh somewhere. |
It's trivial for a user, because you already know your preferred installation method. However, The only current blessed way to install and update |
You could probably do something similar, just retrieving the current version first, and then the install script similarly. Mine tries the |
Add `nvm_get_latest` This relates to #522, #561, #400. `nvm_get_latest` uses http://latest.nvm.sh which redirects to https://github.com/creationix/nvm/releases/latest which in turn redirects to the latest release tag.
Thanks for your script! I have two questions about it:
|
@xfq |
@ljharb I see. Thank you. What about the second question? |
You shouldn't need to reinstall any node versions after updating |
I have just tried reinstalling NVM - But it just doesn't seem to do anything? I have also tried sudo, but still the same non-result Any ideas? |
@surfjedi This was reported in #559 (comment) - can you try |
This comment was marked as resolved.
This comment was marked as resolved.
@ljharb, I don't know what you mean unsafe. I have a good source code, covered with unit tests and more complex tests. I want now to prepare the next version of container with I can't move to I am sure that its an issue. I see no reason why readme has no command for installation of latest version. Your command for installation of fixed version may be first one and installation of the latest version mey be the second one. |
It's unsafe because it's not reasonable to assume that anyone - let alone everyone - has tests covering usage of nvm commands which are often typed by devs, or in CI/build scripts that aren't themselves tested. |
So your plan is the following:
|
I'm not following your logic. If ANY nvm command would stop working, then it's an unsafe update to receive blindly. This is the same reason why a node project should never use |
Ok, you are talking now with this developer, that wants to update system somehow. I am implementing Can you please include a line into readme with installation of recent version of nvm for such developers? |
The line is the one with the explicit version. You're expected to copy and paste the line any time you want to install the latest version, and be aware of the caveats yourself. |
I am using If nvm upgrades it provides the following warning: |
The most safe way for any project life is maintenance. Maintenance means constant everyday upgrades. Developer can migrate code to the next major/minor/patch package version with ease because he won't drown in api changes. Lets remember a project without constant maintanance from real life. We had a customer saying "I have an issue, can you please find a way to fix it?". I've opened project and found it has never been updated since 2018 year. The issue was connected with abandoned ancient version of My resolution was the following:
Customer selected variant 3. Later he came and said "I had an issue with another package". I have provided another low price fix for ancient and abandoned package version. These solutions finally led to project source code death and customer finally paid new project rewrite from scratch. Your politic with fixed version of |
None the less, the decision stands. |
I understand this discussion is closed, but I'd like to summarize it to make sure I understood it and for the sake of anyone else coming here looking for answers to these questions.
|
@rdeforest accurate. also, to make it clear, i do not intend to ever make breaking changes to |
@mgol Could you please open a pullrequest and put your script in a convenient file like update-nvm.sh or so? Would be nice if this would be always already shipped with the application. |
@arnonuem It's up to the maintainer how they want to approach this. I am not sure if the Git upgrade method has some holes in it, all I know is it worked for me. I'd only recommend changing the I also don't use nvm on my local machine anymore so I am not in a position to dive deeper here. Feel free to use my script, though. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Bump. What's the status? Is there an easy way to self-update nvm? |
@nbro10 the easy way is to rerun the install script. |
@ljharb So, to be clear, I've once used the following command to install
If I use (currently, the last version)
What's going to happen exactly? Will this new nvm replace the old one automatically? Or will I have 2 nvms? What happens to the node versions that I installed with version nvm v0.39.5? |
The new one will replace the old one automatically, and all node versions will persist. |
as I said at #3473 , You can push your install script to releases and can make it available at anytime. And if you want to block the ones that want to automate the upgrade by blindly grabbing the latest one, you can block the update on install script, and can add a command like |
If nvm has a command that will update himself, it will be more awesome. Now the method i know is remove nvm and reinstall, but this will set all my node reinstall
The text was updated successfully, but these errors were encountered: