[DevOps] NodeJS installation script for hot update

    Hello, this is script is needed for the hot switch versions of nodeJS on machine. You can have two installed different versions of nodeJS. For example, it's can be v12 and v14.

So is possible to switch on a different version using only one command. Currently, I work only on Linux based (and macOS as a client system) systems and code will be targeted on these systems

#!/bin/sh

# Install nodeJS 14.2.0
sudo su
yum install -y git
curl https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh | bash
source ~/.bashrc
nvm install v14.13.0

# Actual for some oses
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
For getting list of all installed nodes, you can use
#!/bin/sh

nvm ls #list all nodes
nvm use <version># switch to specific version


More information you can get on official repo: https://github.com/nvm-sh/nvm
Or on another site (first link in google):
https://www.sitepoint.com/quick-tip-multiple-versions-node-nvm/

Комментарии

Популярные сообщения из этого блога

Вопросы с собеседования С++ (2018)