Windows local Dev setup WSL #2

Thanks to help from freecodecamp, ive completed the WSL local freecodecamp setup, this post is for documenting any trouble/fixes when attempting to complete, should anyone run into the same issues:

https://contribute.freecodecamp.org/#/how-to-setup-wsl
https://contribute.freecodecamp.org/#/how-to-setup-freecodecamp-locally

there is a broken link at the bottom that will teach you to do the above links:
https://hn.mrugesh.dev/wsl2-dev-setup-with-ubuntu-nodejs-mongodb-and-docker

I followed the two official freecodecamp links, be advised its a different set of instructions, if you run into the following issues:

  1. Mongodb Docker process restarting and failing in endless loop in docker UI:
    Solution: stop/delete the container process, again reenter the following in terminal:
docker run -it \
  -v mongodata:/data/db \
  -p 27017:27017 \
  --name mongodb \
  --restart unless-stopped \
  -d mongo:4.0
  1. Unseccessfuly trying to get your local main branch in sync with upstream/main & Line endings:

You followed the instructions in how-to-setup-wsl & how-to-setup-freecodecamp-locally up until making-changes-locally. The ubuntu on windows terminal shows correctly that there are no changes to commit. The terminal in your VS code shows that there are changes in files despite the fact that youve not made any, and you cant see any actual changes.

The IDE is switching LF to CRLF Windows/Linux conflict (Similarly windows vs Linux where files are case sensitive).

try to fix it:
git config --global core.autocrlf true

Discard all the empty file changes you did not make, if its still not working

install extension “Remote -WSL” in Visual Studio Code Marketplace and repeat the above (try again to discard all changes) and it should work.

Note: you may mistakenly think as I did that by switching the terminals in VS code terminal drop down selection that you are in WSL

you are not, you are only in WSL if you can see WSL in the Lower Left bottom status bar.

e.g. if you see something like this your not in WSL:

Now you know you are:

  1. Mongod

Command 'mongod' not found, but can be installed with:
sudo apt install mongodb-server-core

The instructions are confusing or incorrect, you have already installed docker and try to run this command in the ubuntu shell or wsl in vs code but it doesnt recognize any mongod command

Ignore this as long as you see a mongodb instance in your docker desktop containers you may proceed,
http://localhost:8000/developmentuser should load with the user

So in order to complete these instructions:

I had to click on the open in terminal icon
this opens a seperate docker terminal specific to this container where you can enter these commands:

try to enter the commands here:

Nice job! I see you put in a lot of effort.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.