- update apt
sudo apt update && sudo apt upgrade -y - install package support if not
sudo apt install -y build-essential curl
- install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
- check bashrc
source ~/.bashrc
- check zshrc
source ~/.zshrc
- Check version
nvm --version
-
Install
nvm install 18
-
Use version
nvm use 18
-
Set default version
nvm alias default 18
-
List all version
nvm ls-remote
-
List installed version
nvm ls
-
Install version
nvm install 20.0.0
-
Switch version
nvm use 20.0.0
-
Set default version
nvm alias default 18 -
Delete version
nvm uninstall 18
- Get ip from ubuntu of window
ip route show default | awk '{print $3}'
-
Open "Windows Defender Firewall with Advanced Security"
"Inbound Rules" => "New Rule...".
Select Port -> Next.
set "Specific local ports:" 27017 => Next.
check "Allow the connection" -> Next.
check all (Domain, Private, Public) -> Next.
Set rule name: MongoDB WSL -> Finish.
Run again Nodejs
-
Find file mongod.cfg. location: C:\Program Files\MongoDB\Server<this version>\bin\mongod.cfg
Open this file:
find to item net:
YAML
net: port: 27017 bindIp: 127.0.0.1
update bindIp from 127.0.0.1 to 0.0.0.0:
YAML
net: port: 27017 bindIp: 0.0.0.0 # update line
(Note: 0.0.0.0 - "Allow connection from all ips").
Save file and restart MongoDB Service
-
Restart service
Open Service.msc on windows Restart service name: "MongoDB Server"