# Clean installation of NodeJS
## First uninstall node if is already installed
type `node -v` if you see `node command not found` you can go to the installation part.
otherwise if you get a node version, you need to uninstall it.
### Ubuntu
```shell
sudo apt remove nodejs
sudo apt purge nodejs
sudo apt autoremove
```
after, type `which node` if the result is `node not found` you have been removed nodejs from your system.
otherwise if you see a message like `/usr/bin/local/node` you must delete it with `sudo rm -rf /usr/bin/local/node`
### OSX
type `which node`
- `/usr/local/bin/node` Installed with the official package
- `/usr/local/Cellar/node` Installed with brew
#### Uninstall with official package installation
```shell
sudo rm -rf /usr/local/bin/node
sudo rm -rf /usr/local/bin/node_modules
sudo rm -rf /usr/local/bin/npm
sudo rm -rf /usr/local/bin/npx
rm -rf ~/.node
rm -rf ~/.node_modules
rm -rf ~/.npm
rm -rf ~/.npx
```
#### Uninstall with brew installation
```shell
brew uninstall node
brew doctor
brew cleanup
brew prune
```
## Install NodeJS with Node Version Manager
[official repos](https://github.com/creationix/nvm)
### Ubuntu / OSX
#### bash
`curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash`
#### zsh
`curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | zsh`
when install is finish, type `bash` or `zsh` (dependent of your shell) to update config files.
install node version 11.11.0 (or latest)
```shell
nvm install 11.11.0
nvm use 11.11.0
node -v
11.11.0
```
Now you can use `node` `npm` and `npx` commands