It takes over 1000ms
to switch node
versions (using avn
) whenever we dir into a project folder. Makes carpe diem harder. Degrades my chi. Makes me wanna hurt babies.
Strictly speaking, you can uninstall nvm
(which I'm assuming you use)
rm -rf $NVM_DIR
and the just install n
from npm
:
npm i -g n
But that's just being lazy, and n
is known to break npm
and shit. There's a better way.
Quickly, off the top of your head (and without running which node
) - where do you keep all your node
versions?
Never mind that, where's the current node
version installed? How did it get there; did you use brew install node
, or downloaded the installer from the official site? Maybe it was already there when you got your computer.
Thing is, if you don't know where your node
lives, how do you expect to manage multiple versions of it, including all the different npm
s, efficiently?
I say, let's begin from scratch.
Go here. Follow the instructions to clear your system of all node
related things. Oh, but first, run
npm list -g --depth=0
So you'll know which global packages you need to reinstall later.
If you use brew
, I suggest running brew uninstall node && brew prune
before hand.
Two reasons for using n-install:
- It doesn't require
sudo
. - It doesn't require
sudo
.
Cool.
curl -L https://git.io/n-install | bash
Now, install avn-n
for that sweet automatic package-switching magic:
npm i -g avn-n
Now, go visit a folder with an .nvmrc
file in it. Go on. See how fast it is. Totally worth it.
Time to reinstall all those global node modules. Pesky, I know. On the flip side, now you know where everything lives and how it got there. And your avn
is so much faster now.