NVM (Node Version Manager) is a bash script that allows you to manage multiple Node.js versions on a per-user basis. With NVM, you can install and uninstall any Node.js version that you want to use or test.
Visit the nvm GitHub repository page and copy either the curl or wget command to download and install the nvm script:
˜ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
Do not use sudo , as it will enable nvm for the root user.
The script will clone the project’s repository from GitHub to the ~/.nvm directory. Close and reopen your terminal to start using nvm, or run the following to use it now:
˜ 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
As the output above says, you should either close and reopen the terminal or run the commands to add the path to nvm script to the current shell session. You can do whatever is easier for you.
Once the script is in your PATH, verify that nvm was properly installed by typing:
˜ nvm --version
˜ 0.39.7
To get a list of all Node.js versions that can be installed with nvm, run:
˜ nvm list-remote
The command will print a huge list of all available Node.js versions.
To install the latest available version of Node.js, run:
˜ nvm install node
The output should look something like this:
˜ Checksums matched! ˜ Now using node v21.5.0 (npm v10.2.4) ˜ Creating default alias: default -> node (-> v21.5.0)
Once the installation is completed, verify it by printing the Node.js version
˜ node --version ˜ v21.5.0
Let’s install two more versions, the latest LTS version, and version 18.10.0:
˜ nvm install --lts ˜ nvm install 18.10.0
You can list the installed Node.js versions by typing:
˜ nvm ls
The output should look something like this:
˜ -> v18.10.0 ˜ v20.10.0 ˜ v21.5.0 ˜ default -> node (-> v21.5.0) ˜ iojs -> N/A (default) ˜ unstable -> N/A (default) ˜ node -> stable (-> v21.5.0) (default) ˜ stable -> 21.5 (-> v21.5.0) (default) ˜ lts/* -> lts/iron (-> v20.10.0) ˜ lts/argon -> v4.9.1 (-> N/A) ˜ lts/boron -> v6.17.1 (-> N/A) ˜ lts/carbon -> v8.17.0 (-> N/A) ˜ lts/dubnium -> v10.24.1 (-> N/A) ˜ lts/erbium -> v12.22.12 (-> N/A) ˜ lts/fermium -> v14.21.3 (-> N/A) ˜ lts/gallium -> v16.20.2 (-> N/A) ˜ lts/hydrogen -> v18.19.0 (-> N/A) ˜ lts/iron -> v20.10.0
The entry with an arrow on the right (v18.10.0) is the Node.js version used in the current shell session, and the default version is set to v21.5.0. The default version is the version that will be active when opening new shells.
If you want to change the currently active version, enter:
˜ nvm use 18.10.0
˜ Now using node v18.10.0 (npm v8.19.2)
To change the default Node.js version, run the following command:
˜ nvm alias default 18.10.0
For more detailed information about how to use the nvm script, visit the project’s GitHub page.
for v18x, adds the sources to /etc/apt/sources.list.d and installs
˜ curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - &&\ ˜ sudo apt-get install -y nodejs
Before that, you might to remove the legacy version if you installed it from
the athdart ubuntu sources
˜ sudo apt remove node js ˜ sudo apt-get purge nodejs-legacy nodejs ˜ sudo apt autoremove
install latest
˜ npm init vite@latest
install specific version
˜ npm create vite@2.9.5
cd to new directory
˜ npm install
install libraries:
˜ npm install animejs ˜ npm install threejs ˜ npm install tone
install three autocomplete support:
˜ npm install --save @types/three
import libraries:
˜ import anime from 'animejs/lib/anime.es.js'; ˜ import * as THREE from 'three'; ˜ import * as Tone from 'tone';
run vite severs:
˜ npm run dev ˜ npm run serve
bulid:
˜ npm run build
Sass:
support built in vitejs but need to add compiler
˜ npm install -D sass
them import sass file instead on css fime in main.js (To be tested)
get this preconfigured scaffold: https://github.com/adamaslan/p5-vite-take2
˜ npx degit makinteract/p5js-vite my-project ˜ cd my-project ˜ npm install ˜ npm run dev