To give some context, I set up my machine using this Medium post, Don’t Use sudo
with npm
…still.
I installed Node using brew
about a year and a half ago, which installed v12.18.1. I also installed n
at the time using brew
, but never had to change versions until now.
My .zshrc
file includes the following:
# For globally installed npm packages (without using sudo)
export PATH="$HOME/.npm/bin:$PATH"
# Path to n (managing node versions)
export N_PREFIX="$HOME/.n"
export PATH="$PATH:$N_PREFIX/bin"
When I install Node v14 with n
, the following occurs:
➜ ~ node -v
v12.18.1
➜ ~ n 14
installed : v14.15.4 to /Users/myusername/.n/bin/node
active : v12.18.1 at /usr/local/bin/node
➜ ~ node -v
v12.18.1
I see that the version was successfully installed; however, the active version doesn't update. I noticed that the path of the installed version is clearly different than the active version (reference terminal output above), which I suspect is the issue.
Any help would be greatly appreciated! Thank you in advance.
Additional information: When I installed Node initially, yarn
was not available despite the article linked at top stating it should be so I installed n
using brew
. To troubleshoot, I ran brew uninstall n
, however, the following was output:
Warning: The following may be n configuration files and have not been removed!
If desired, remove them manually with `rm -rf`:
/usr/local/etc/bash_completion.d
And so then I ran rm -rf /usr/local/etc/bash_completion.d
. Nothing printed to the terminal after.
n doctor
showed:Checking n install destination priority in PATH... There is a version of node installed which will be found in PATH before the n installed version.
By implementing the change suggested and re-sourcing the.zshrc
file, everything seems to be working beautifully! – Turf