Skip to content
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

GH-706 Update location change message #707

Merged

Conversation

agarzola
Copy link
Contributor

@agarzola agarzola commented Jan 6, 2022

Pull Request

This pull request updates the message printed for a user when installing a new version of Node.js via n results in a location change for the binary.

Closes GH-706.

Problem

One of the recommended solutions does not work in Dash:

Note: the node command changed location and the old location may be remembered in your current shell.
         old : /usr/bin/node
         new : /app/.global/bin/node
To reset the command location hash either start a new shell, or execute PATH="$PATH"

See GH-706.

Solution

Update the message to suggest an alternative if using Dash:

Note: the node command changed location and the old location may be remembered in your current shell.
         old : /usr/bin/node
         new : /app/.global/bin/node
If "node --version" shows the old version then start a new shell, or reset the location hash with:
hash -r  (for bash, zsh, ash, dash, and ksh)
rehash   (for csh and tcsh)

ChangeLog

Update location change message with recommendation for Dash.

@agarzola agarzola force-pushed the gh-706-update-location-change-message branch from cdf6624 to 074d68c Compare January 8, 2022 19:59
Copy link
Contributor Author

@agarzola agarzola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ready for final review!

bin/n Show resolved Hide resolved
bin/n Outdated Show resolved Hide resolved
@shadowspawn shadowspawn changed the base branch from master to develop January 8, 2022 20:20
@shadowspawn shadowspawn merged commit eff4dd4 into tj:develop Jan 8, 2022
@shadowspawn shadowspawn added the pending release Merged into a branch for a future release, but not released yet label Jan 8, 2022
@shadowspawn
Copy link
Collaborator

Thanks. This situation is very confusing when a user encounters it for the first time and makes n seem broken, so worth trying to help as much as possible.

@shadowspawn
Copy link
Collaborator

Example of new message in action:

$ export N_PREFIX=$HOME/.n
$ export PATH=$N_PREFIX/bin:$PATH
$ node --version
v16.13.1
% n 14
  installing : node-v14.18.2
       mkdir : /Users/john/.n/n/versions/node/14.18.2
       fetch : https://nodejs.org/dist/v14.18.2/node-v14.18.2-darwin-x64.tar.xz
   installed : v14.18.2 (with npm 6.14.15)

Note: the node command changed location and the old location may be remembered in your current shell.
         old : /usr/local/bin/node
         new : /Users/john/.n/bin/node
If "node --version" shows the old version then start a new shell, or reset the location hash with:
hash -r  (for bash, zsh, ash, dash, and ksh)
rehash   (for csh and tcsh)
$ node --version
v16.13.1
$ hash -r
$ node --version
v14.18.2

@agarzola
Copy link
Contributor Author

agarzola commented Jan 8, 2022

Thanks for letting me make this small contribution! I've so far had a delightful experience with n and cannot thank you enough for maintaining this project.

@shadowspawn shadowspawn removed the pending release Merged into a branch for a future release, but not released yet label Jan 8, 2022
@shadowspawn
Copy link
Collaborator

Improvements included in n v8.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dash does not refresh its hash table when PATH is re-declared
2 participants