Ubuntu 20.04 shell loads slow because of "npm config --loglevel=warn get prefix" command

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:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

If you do have these lines in your .bashrc please add the --no-use flag like this:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" --no-use  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

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.