My shell always takes a couple of seconds to load the first time when I boot up, after boot up, when I open up the terminal multiple times to load the shell again and again the boot time decreases to around 1.5 second.
Upon following the advice of this on another question relating to slow loading of shell.
I found that npm config --loglevel=warn get prefix
takes the longest time always, rest commands load instantaneously every time.
I was not able to find some pointers on the net and hence I asked here.
My npm version is 6.12.0
I realize this comes when bash loads the nvm.sh
script, but how can this be made faster, if at all?
I had the same issue but then I noticed the actual problem was with the
nvm
being loaded during the bash startup in the.bashrc
, please check if you have these lines in your.bashrc
:If you do have these lines in your
.bashrc
please add the--no-use
flag like this:This basically doesn't make it run on the initialization of your bash session and you would be able to use
nvm
as usual, you're just skipping it being loaded when your bash session starts.I went from 6 seconds of waiting for bash to load up to just 0.1 seconds.