markdown干净安装nodejs(代码片段)

author author     2022-12-13     125

关键词:

# 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在bash上安装nodejs,yarn(代码片段)

查看详情

markdown在macos上安装nodejs和npm(代码片段)

查看详情

markdown奇怪的是“git没有干净地退出(退出代码1)”(代码片段)

查看详情

markdown的nodejs-的console.log时间线,function.js(代码片段)

查看详情

markdown安装(代码片段)

查看详情

markdown安装(代码片段)

查看详情

markdown安装模块(代码片段)

查看详情

markdown安装错误(代码片段)

查看详情

markdown安装新人(代码片段)

查看详情

markdown安装proftp(代码片段)

查看详情

markdown安装kibana(代码片段)

查看详情

markdown安装kubernetescoreos(代码片段)

查看详情

markdown安装php(代码片段)

查看详情

markdown安装dockercompose(代码片段)

查看详情

markdown03-安装模块(代码片段)

查看详情

markdown安装r.(代码片段)

查看详情

markdown安装laravelimpersonate(代码片段)

查看详情