You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running an install does not always do anything, and there is no feedback to inform the user (#198). The install is silently skipped if the active version of node matches the requested version, and an activation is likewise silent so not visibly different.
This might be reasonable if only node was involved, but there is npm too. I personally find this problematic when intending to restore to a shipping combination of node+npm, or trying to recover or give recovery instructions from a broken npm.
Example Scenarios
Uncertain outcome
n lts
# Did anything happen? What version of npm is active now?
If you had a different version of node active, you now have the npm that ships with node lts
If node lts was already active, then nothing has changed and npm has not changed from whatever you had before (which you may have manually updated, or broken)
Extra steps to get predictable outcome
If you have a broken npm, or want someone to get to a known state, it takes two instructions. For example, change to a dummy version of node so that the second instruction actually does what is intended. (When I found myself doing this I decided it indicated a problem!)
As a bonus and following the same pattern, include extra output if active version of node is different than installed (due to PATH problems). This should help with a common problem case that trips people up and causes help requests (#213#261#290#300#367#381#400#451).
$ N_PREFIX=~/deleteme n 10.14.1
install : node-v10.14.1
mkdir : /Users/john/deleteme/n/versions/node/10.14.1
fetch : https://nodejs.org/dist/v10.14.1/node-v10.14.1-darwin-x64.tar.gz
installed : v10.14.1 to /Users/john/deleteme/bin/node
active : v10.14.2 at /usr/local/bin/node
Alternatives
I considered adding a --force and/or adding a message when skipping the install, but I think always doing the install is simpler and clearer.
Could test both the node and npm versions before skipping the install, but again I prefer keeping it simple.
People do find it confusing what happens with npm. It might might be worth adding npm version to the progress messages too.
The text was updated successfully, but these errors were encountered:
If we do retain the optimization skipping the reinstall, n should check the version in its own install location rather than just the active version of node.
(Opening an issue for opportunity for feedback.)
Problem
Running an install does not always do anything, and there is no feedback to inform the user (#198). The install is silently skipped if the active version of node matches the requested version, and an activation is likewise silent so not visibly different.
This might be reasonable if only node was involved, but there is npm too. I personally find this problematic when intending to restore to a shipping combination of node+npm, or trying to recover or give recovery instructions from a broken npm.
Example Scenarios
Uncertain outcome
n lts # Did anything happen? What version of npm is active now?
Extra steps to get predictable outcome
If you have a broken npm, or want someone to get to a known state, it takes two instructions. For example, change to a dummy version of node so that the second instruction actually does what is intended. (When I found myself doing this I decided it indicated a problem!)
n 8.0.0 # Any other version! n 10.14.2
Proposed Changes
As a bonus and following the same pattern, include extra output if active version of node is different than installed (due to PATH problems). This should help with a common problem case that trips people up and causes help requests (#213 #261 #290 #300 #367 #381 #400 #451).
Alternatives
I considered adding a
--force
and/or adding a message when skipping the install, but I think always doing the install is simpler and clearer.Could test both the node and npm versions before skipping the install, but again I prefer keeping it simple.
People do find it confusing what happens with npm. It might might be worth adding npm version to the progress messages too.
The text was updated successfully, but these errors were encountered: