markdown 干净安装NodeJS

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 干净安装NodeJS相关的知识,希望对你有一定的参考价值。

# 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

以上是关于markdown 干净安装NodeJS的主要内容,如果未能解决你的问题,请参考以下文章

markdown Ubuntu安装NodeJs

markdown 安装NodeJS

markdown 在BASH上安装NodeJS,Yarn

markdown 在macOS上安装NodeJS和NPM

nodejs,CSDN转markdown

基于nodejs的一个实时markdown转html工具小程序