# Ubuntu 22.04 - Install Node.js and NPM
###### tags: `Ubuntu` `Node.js`
> **Date**:2024/02/05
> **Taker**:Sin
## Installing Node.js using NVM
### Installing NVM on Ubuntu
```bash
sudo apt install curl
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
```
#### Load the environment
```bash
source ~/.profile
```
#### Installing Node using NVM
```bash
nvm install node
```
```bash
nvm install v20
```
#### Working with NVM
```bash
nvm use v20
```
```bash
nvm alias default v20
```
## Installing Node.js with Apt Using a NodeSource PPA
### Install the PPA (if different can replace 18.x)
```shell
cd ~
curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh
```
### You can inspect the contents of the downloaded script:
```shell
vim nodesource_setup.sh
```
### Run the script with sudo
> Running third party shell scripts is not always considered a best practice, but in this case, NodeSource implements
> their own logic in order to ensure the correct commands are being passed to your package manager based on distro and
> version requirements.
```bash
sudo bash nodesource_setup.sh
```
### If you have Node.js installed, please remove the Node.js and npm
```bash
sudo apt remove nodejs npm
```
### Install nodejs
```bash
sudo apt install nodejs
```
### Verify installed version
> The NodeSource Node.js package contains both the node binary and npm, so you don’t need to install npm separately.
```bash
node -v
```
## Install vue cli
### Install
```bash=
sudo npm install -g @vue/cli
sudo npm update -g @vue/cli
```
### Uninstall
```bash!
sudo npm uninstall --global @vue/cli
```