DEV Community

loading...

Learn to code using FreeCodeCamp Especially If You Do Not Have 24/7 Internet Access

Opeyemi Stephen
A trusted voice,a cool head and an undaunted initiative in messy situations. Currently getting my butt whooped by JavaScript.
・5 min read

My previous post was supposed to be a rant...a way of releasing my pent-up anger and frustration at the system and the very scarce resources it was swallowing, with little returns and immense presure all because I wanted to make a difference. The reception and similar experiences I read in the comments section is a source of motivation I will never take for granted.

I am working with a few people to build solutions which would help the average developer and while that would take some level of planning, implementation and even donations, I thought of other non-monetary(if there's a word like that) ways of helping newbies.

So...lots of research, a bout of serious typhoid fever, speaking with awesome developers including Jay, Trevor and Sebastian and my laptop getting spoilt by a power surge on the very day I wanted to POST this later, I was able to come up with this...now ask yourself...

HOW WOULD YOU LIKE TO BE ABLE TO USE FREECODECAMP AND ITS AMAZING LEARNING RESOURCES AND CERTIFICATIONS WITHOUT THE INTERNET?

Awesome yeah? Check out FreeCodeCamp here Link

You're probably thinking this is hard and it might take a long time to set up, well it isn't. You should be done in an hour or less.

Preliminary Requirements

  • First you need to have a working computer/laptop.(Thankfully I was able to get this post compiled before mine got spoilt).

  • You would also need initial internet connectivity.(This is so you can download the necessary FreeCodeCamp files from GitHub).

  • Lastly, you would need a resilience like no other. This is because it is one thing to download and set this up and it's a whole different thing to actually PUT THESE RESOURCES TO USE AND LEARN. Do not procastinate, start learning!

First Step: Setting Up Your Database On Your Local Machine

We will be making use of a document-oriented database called MongoDB. To learn more about MongoDB and why it is used, i have a helpful article here Link

Let's go on and install MongoDB. You can find the necessary documentation to install on all supported Operating Systems here

Link

I will be using Windows 10 so kindly follow the steps below if you use windows 10 as well.

  1. Download the latest version(mine was 4.4.6) at Link (make sure to select "On-Premises MongooDB locally" and on the right-hand side select "msi" as Package. Learn more about "msi" here Link

The user interface of the MongoDB download page

  1. After the Download is complete, navigate to your file location and install.

  2. When you get to the prompt that says "Custom SetUp", make sure all features are selected and the "Server" is set to "install on the local hard drive, C:".

Custom Setup

  1. Click "Next"

  2. You should be in "Service Configuration" now. Unselect the checkbox which says "Install MongoDB as a service". We are doing this so MongoDB doesn't use up all your computer's memory and we will only run it before starting up FreeCodeCamp. You are not Google or Netflix my friend, winks. Click "Next".

Service Configuration

  1. Keep Clicking "Next" to complete the rest of the installation.

Second Step: Setting Up Node.js and NPM

Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser.

NPM stands for Node Package Manager and is always installed with Node.js

To learn more about NPM, you can check this resource Link

To learn more about node.js, you can check this resource Link

Download and install node.js by clicking Link

Make sure to download the recommended msi version (14.17.0 LTS).

When this prompt below comes up, select the checkbox

Select the Check Box To Download Other Dependencies

This will enable your system to also install additional packages and dependencies when you need them and build stuff on FreeCodeCamp as well. Chocolately, Python and other packages will also be installed with this step

Third Step: Cloning FreeCodeCamp From GitHub

First thing to do is to install Git using your computer's package manager.

You can type "choco install git"

If you still do not know how, you can install normally here Link

  1. Open a new folder titled "FreeCodeCamp" on your computer.

Then Open your terminal or Windows Powershell and follow the following sub-steps;

  1. Using "cd" and "ls" commands, navigate to the FreeCodeCamp folder(directory) which you opened in 1.

  2. Clone FreeCodeCamp and its necessary accompanying files using git by typing the following command in your Powershell or Terminal

git clone --depth=1 https://github.com/freeCodeCamp/freeCodeCamp

Fourth Step: SetUp and Install FreeCodeCamp On Your Local Machine

Use "cd" to navigate into the FreeCodeCamp directory you just cloned and then type the command below to begin installation(might take a while but you've already come this far so be patient my friend)

"npm ci"

DO NOT CLOSE THIS POWERSHELL/TERMINAL WINDOW YET

Fifth Step: Starting Up The MongoDB Database

You will need to always start the service in 2 below before you can run FreeCodeCamp everytime so you can do well to note it down somewhere.

  1. Open up a new window in your terminal or Powershell while waiting for the installation in the Fourth Step above.

  2. You can start up the MongoDB database by following the steps below:

Windows Users: Navigate as seen below and then type in the command

"C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe" --dbpath=/path/to/freeCodeCamp
Enter fullscreen mode Exit fullscreen mode

Linux Users: Navigate as seen below and then type in the command

mongod --dbpath=/path/to/freeCodeCamp
Enter fullscreen mode Exit fullscreen mode

DO NOT CLOSE THIS POWERSHELL/TERMINAL WINDOW YET

Sixth Step: Seeding the MongoDB Database

  1. Remember the installation in Step 4? It should be completed by now.

  2. Go back to that Powershell or Terminal window and then type in the command below just once;

"npm run seed"

Note: In subsequent times, you do not have to run the above command again because your would have already been initialized.

7th Step: Start FreeCodeCamp

  1. Go back to the Powershell terminal in the Sixth Step.

  2. Run this command to start FreeCodeCamp

"npm run develop"

It might take an awful lot of time but as long as you have a stable internet connection, trust the process and let the building sun its full course. it took about 8 minutes on my end.

How do i know it's done? You should see this line

success Building development bundle - 497.330s
Enter fullscreen mode Exit fullscreen mode

Step 8:

  1. Open up your preferred browser and type in [Link}(http://localhost:8000)

  2. Click "Get Started Now, It's Free!"

  3. You should see " Welcome back, development user".

  4. Congratulations, you can access all the courses now without the internet. Your progress will be saved in the MongoDB commands run in Step 5.

Question: What I want to start FreeCodeCamp later, do i need to go through all the steps again?

Answer: Of course not, next time you can do so without the internet by following the instructions on Step 5 and 8 in two different terminals/powershells.

May The Stars Align For You Fellow Dev....Major shoutouts to every resource I previously read and a few blogs that already did something like this. I hope this helps us all.

Discussion (21)

Collapse
cjsmocjsmo profile image
Charlie J Smotherman

This is awesome.

Have you considered putting this in a docker container and put it up on dockerhub?

Would make installation much easier, just an idea.

Collapse
danbamikiya profile image
Dan Bamikiya • Edited

"It will make installation easier" - for those who know how to use and troubleshoot Docker.
The point of doing this local setup is to get beginners learning immediately without any distractions.
Also it'll require installation of docker and/or docker-compose which requires WSL2 setup for windows users (as I assume most users are) all those steps are a lot of hassel for any beginner especially those running Win32 OS. Not to mention it also takes up a LOT of resources (memory, power e.t.c) and needs much more data (internet) connection to do all that (which nullifies the entire point of the post which is inadequate internet access) than the proposed setup here in this post.

Collapse
cjsmocjsmo profile image
Charlie J Smotherman

Learning how to install software is a distraction? sudo apt-get install docker seems pretty easy to me. Installing software is the first thing a newbie needs to learn. Besides FreeCodeCamp will have them installing additional software anyway (if they want to follow along with the lesson). Troubleshooting just Docker instead of mongo and npm sounds easier to me. Not to mention docker containers are disposable so a newbie is less prone to screwing up the underlying OS. And your assumption that most users use Win32 is incorrect, I personally have no use for Win32 and deploy it on NONE of my machines. I use docker on my raspberry pi B+, armv7 with 900mb ram, that sounds pretty low power to me, so I imagine docker will do just fine on a nice beefy laptop.
Well they are going to have to download npm, mongo, and the FreeCodeCamp git repos anyway why not have it in one nice neat bundle? As you can see in some more recent posts to this article people will have trouble installing the individual pieces alone.

Thread Thread
danbamikiya profile image
Dan Bamikiya • Edited

Learning how to install software is a distraction? - Yes, it is a BIG distraction for beginners who just want to learn HTML, CSS, JS.
sudo apt-get install docker seems pretty easy to me - Do you even know what you're talking about? Have ever maintained an Open Source project or even been on Github? Because if you have, you'll know software that works well for you will definitely not work well for others INCLUDING DOCKER. There's ALWAYS going to be users that have trouble using software would rather put on extra burden on beginners that just want to get started in coding and on the author (because he'll have to be the one troubleshooting and answering everyone's question on their Docker problems just to learn HTML, CSS and JS).
If you've been around beginners you'll know overwhelming them with tooling they are not going to be using at the stage they are at is the last thing you'll want to do.

Installing software is the first thing a newbie needs to learn. - NPM and Git is enough tooling to learn for EVERY coding "newbie"

Troubleshooting just Docker instead of mongo and npm sounds easier to me. - You're just contradicting yourself and admitting to my point in the previous comment which says: "It will make installation easier" - for those who know how to use and troubleshoot Docker.

Not to mention docker containers are disposable so a newbie is less prone to screwing up the underlying OS. And your assumption that most users use Win32 is incorrect, I personally have no use for Win32 and deploy it on NONE of my machines. - You're just seeing stuff from only your own experience and forgetting that every user's setup and hardware is different so there's always going to extra troubleshooting if they going to be using Docker.
Also you didn't read that part of my comment properly so I'll repost here:
"Also it'll require installation of docker and/or docker-compose which requires WSL2 setup for windows users (as I assume most users are) all those steps are a lot of hassel for any beginner especially those running Win32 OS." For clarification I said users are mostly going to be using Windows (not Win32) which will require WSL2 setup (an hassel on it own), read the docs first incase you want to argue this point Install Docker Desktop on Windows and for those using low end Win32 OS laptops it's officially not supported as you could see in the docs and if you want to know the kind of hassel beginners would go through see here.

"so I imagine docker will do just fine on a nice beefy laptop." No it won't like you said you're imagining. And like I said Not to mention it also takes up a LOT of resources (memory, power e.t.c) and needs much more data (internet) connection to do all that (which nullifies the entire point of the post which is inadequate internet access) than the proposed setup here in this post. You also didn't address the point where it takes much more internet connection to setup successfully.

why not have it in one nice neat bundle? - Its not going to be a nice experience for everyone because you don't know everyone's hardware setup.

As you can see in some more recent posts to this article people will have trouble installing the individual pieces alone. - You didn't even read the solution to that problem which was a common npm problem that: The person wanted to run an npm clean-install in a directory without a package.json file which is bound to not work.
The problems they are going to encounter using the proposed setup are those common these tooling which can be troubleshooted relatively easily and isn't out of the scope of what they want to learn or are learning already.

Thread Thread
cjsmocjsmo profile image
Charlie J Smotherman

lets agree to disagree

It was nothing more than a simple suggestion not worthy of such a heated discussion. Ultimately it is up to Stephen. Have a good day.

Thread Thread
danbamikiya profile image
Dan Bamikiya • Edited

I get your point and for coders experienced with Docker yes it would be easier and I wasn't aiming to start an argument but to help others see the possible downsides of using Docker for coding beginners. Also if I was provocative in passing my points accept my apology 🙏.

I'll also say to Stephen that if he sees an advantage of using Docker for beginners he could give it a try, already there's an hype around it so some learners may want to see how its like and how its being used and it'll also be an addition to their skill set (which was what made me learn it in the first place).
Have a great day too 😀!

Thread Thread
cjsmocjsmo profile image
Charlie J Smotherman

I must admit I was under the assumption that Dock Desktop was a freely available app for Win32 users.

I have since found out it this not the case. Now I understand why it may be painful to install docker on Win32 for some users, and now agree with you on some of your points.

If you dig through the changelogs of all the Ubuntu and Debian packages you will find my name on one or two of them. So yea I know about contributing to open source projects, and how hard it is to get software to install/remove /purge from a system consistently. Some times it's fun, some times it's not so fun.

But in the end learning is the objective. I have learned from this discussion as I hope others have.

happy coding

Thread Thread
danbamikiya profile image
Dan Bamikiya

Wow it must be great contributing to such important projects!

Yeah installing a lot of multi-platform software is sometimes an hassel on Windows machines and sometimes worse on Win32.

I also agree using a Docker image is a neat way to do things and a fun way to challenge oneself.

Happy coding also!

Collapse
resourcefulmind profile image
Opeyemi Stephen Author

I didn’t know about this but I would definitely do the necessary research and get this done. Thank you so much for your suggestions man!

Collapse
patrickkyei profile image
Patrick-Kyei • Edited

I run into an error when I try to seed the database. Pls what could be wrong

at Module._compile (internal/modules/cjs/loader.js:1256:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1277:10)
at Module.load (internal/modules/cjs/loader.js:1105:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @freecodecamp/freecodecamp@0.0.1 seed: cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedAuthUser
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @freecodecamp/freecodecamp@0.0.1 seed script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/patrick/.npm/_logs/2021-06-06T07_12_56_557Z-debug.log

Collapse
holdenmad profile image
Holden

This is a fantastic resource. Thank you so much for putting this together and allowing people with inconsistent internet to access FCC. It also seems easy enough for beginners to do without too many hiccups.

Collapse
resourcefulmind profile image
Opeyemi Stephen Author

Thank you for the kind words Holden, we owe it to ourselves to help one another.

Collapse
maurizok profile image
Maurice Kosisochukwu Oodo

I can't seem to complete step 4 successfully. Here is the error messages
:\Users\dell>cd desktop

C:\Users\dell\Desktop>cd freecodecamp

C:\Users\dell\Desktop\freeCodeCamp>npm ci
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\dell\Desktop\freeCodeCamp\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\dell\Desktop\freeCodeCamp\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dell\AppData\Roaming\npm-cache_logs\2021-06-04T07_00_11_163Z-debug.log

Collapse
kbono profile image
Jose Manuel Viloria

Validate that you really have a package.json in such route.

Collapse
maurizok profile image
Maurice Kosisochukwu Oodo

Thank you!

Collapse
Collapse
itsraghz profile image
Raghavan alias Saravanan Muthu

This is definitely a super awesome post. Thank you Stephen :)

Collapse
resourcefulmind profile image
Opeyemi Stephen Author

You’re welcome anytime

Collapse
geokal profile image
Giorgos Kalpaktsoglou

You could even add devdocs.io and download / cache all API's frequently used in your browser's cache

Collapse
andemosa profile image
Anderson Osayerie

I would give this a trial. Thanks for sharing

Collapse
resourcefulmind profile image
Opeyemi Stephen Author

You are very much welcome.