Install the WSL

Search for Ubuntu in the Microsoft Store, select Ubuntu 20.04 LTS, and install

Set the user name and password as prompted. Sudo passwd root Set the root password

Install the NVM

NVM must be installed, otherwise the NPM package installed globally under Windows will cause some strange problems when used by the WSL subsystem

Type the command

The curl - o - https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bashCopy the code

or

Wget - qO - https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bashCopy the code

If not, try it.

git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`
Copy the code

then

cd ~/.nvm
vim ~/.bashrc
Copy the code

Add the following to save

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Copy the code

Check whether the installation is successful

nvm --version
Copy the code

Install the Node

NVM I 14.8.0Copy the code

Check whether the installation is successful

node -v
npm -v
Copy the code

WSL to replace APT source

Backup source file

cd /etc/apt/
sudo cp sources.list sources.list.bak
Copy the code

Modifying the source file

sudo vim sources.list
Copy the code

Replace the content with

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted  universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverseCopy the code

Update the software list

sudo apt-get update
sudo apt-get upgrade
Copy the code

Install the NRM

npm install -g nrm
Copy the code

Webstorm uses WSL as its Terminal

File -> Settings -> Terminal -> Shell path set to wsl.exe

Install cmder

Download Full

From my computer – right-click properties – Advanced System Settings – Environment Variables – System Variables – add the cmder installation path in path.

Open cmd.exe and enter cmder. exe /REGISTER ALL

Open cmder, win+ Alt +p set startup task to {WSL::bash}