-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[readme] Update shell profile file install notes #2241
Merged
Merged
+1
−1
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Adds a note for how to fix the issue when the install script is not updating the correct profile file.
d5c562d
to
6d9cd2e
Compare
ljharb
reviewed
Jul 20, 2020
Closed
@ljharb Would we want to include this, since we determined that piping through other shells might break backward compatibility. |
ljharb
reviewed
Mar 26, 2021
c6cfc3a
to
c20db2a
Compare
ljharb
approved these changes
Feb 3, 2025
ljharb
added a commit
that referenced
this pull request
Mar 11, 2025
New Stuff - `install.sh`: add `$ZDOTDIR` to zsh search (#3458) Fixes - `reinstall-packages`: do not reinstall corepack (#3544) - avoid bash-specific syntax (#3499) - `install-latest-npm`: npm v11 is out - `nvm_install_latest_npm`: avoid unbound variable (#3447) - give a more helpful message when `lts` alias is mistakenly used (#3441) - `nvm ls`, `nvm alias`, `nvm install`: error when an LTS name is invalid - `nvm_normalize_lts`: error when an LTS name is not lowercase (#3417) Documentation - [readme] update link - [readme] fix `--no-use` example (#3479) - [readme] update copyright notice (#3507) - [readme] note zsh-nvm's AUTO_USE option (#2670) - [readme] add note about reloading zshrc after editing (#3052) - [readme] Update shell profile file install notes (#2241) - [readme] add docker tips (#2318) - [readme] remove `avn` from readme (#3469) - [readme] fnm -> nvm.fish (#2541) Refactors - prefer `case` over if/else chains - combine `sed -e` invocations/arguments Tests - `nvm exec`/`nvm run`: add `--silent` tests (#1259) - [actions] release test needs git tags - migrate `installation_iojs` test suite to GitHub Actions (#3476) - Migrate slow test suite from Travis CI (#3470) - temporarily skip this failing travis test to unblock progress - [actions] TOC: use latest LTS node - `install.sh`: clean up `nvm_detect_profile` tests - `nvm_detect_profile`: refactor (#3467) - run urchin tests on pull requests (#3466) - update mocks - ensure that unit tests use only mocked LTS names - [actions] use `node/install` instead of `node/run` Meta - disable blank issues - update issue template - add DCO (#3456) - Rename .github/ISSUE_TEMPLATE.md to .github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md (#3454)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
informational
installing nvm: profile detection
Issues with nvm's own install script, related to figuring out the right profile file.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
which will return the default shell.
updating the correct profile file.
NOTES ON CHANGES:
This documentation change is to help users who are finding that the install script is not updating the correct shell profile file.
$SHELL
will return the path to the default shell used, which will set the environment variables used by the install script to decide which profile file to update. There are reports of users not sure why their preferred profile file is not being updated here #2196.I suspect that many of these are from people running the given curl command, which currently pipes the install script into bash explicitly, even if the user has zsh or another shell as their default. This will especially bite MacOS Catalina users who now have zsh as their default shell.
There is also a way for users to explicitly set which profile file to change by the install script, which some users have asked for not knowing it already exists. Here #2188, #869 . This lets them know how to do that.
CAVEATS:
I would prefer to use an variable like
$0
instead of$SHELL
as$SHELL
does not return the currently used shell, but the default shell. The reason why$0
can't be used is that it returns the current shell with a-
in front of it. Once you switch to another shell and then back, the-
is gone, but its there for all uses before switching to another shell and back.$SHELL
however is better than the current example which statesbash
explicitly.Also, it would be better for the install script to be a smarter about which profile file to change. Right now it is using the existence of
$BASH_VERSION
,.bashrc
,.bash_profile
,$ZSH_VERSION
,.zshrc
, and then.profile
, in that order, to decide. It could instead look at which shell is being used and then set the corresponding profile file, through something like$SHELL
or$0
. I'm not versed in shell script so will leave those changes to someone with more experience.