Before you can start writing scraper code, you need to have your computer set up for it. In this chapter, we will show you all the tools you need to install to successfully write your first scraper.
To install Node.js visit the official Node.js website, download the installer, and follow the instructions.
There are many text editors you can choose from for programming. You might already have a preferred one so feel free to use that. Just make sure it has syntax highlighting and support for Node.js. If you don't have any text editor, we suggest starting with VSCode. It's free, very popular, and well maintained. Download it here.
Once you downloaded and installed it, you can open a folder where we will build your scraper. We recommend starting with a new, empty folder.
Before we start, let's confirm that Node.js was successfully installed on your computer. To do that, run those two commands in your terminal and see if they correctly print your Node.js and NPM versions. The next chapters require Node.js version 15.10 or higher. If you skipped Node.js installation and want to use your existing version of Node.js, make sure that it's 15.10 or higher.
node -v npm -v
If you installed VSCode in the previous paragraph, you can use the integrated terminal.
If you're still wondering what a "terminal" is, we suggest googling for a terminal tutorial for your operating system because individual terminals are different. Sometimes a little, sometimes a lot.
After confirming that
node is correctly installed on your computer, use your text editor to create a file called
hello.js in your folder.
Now add this piece of code, save the file, and run the below command in your terminal.
You should see Hello World printed in your terminal. If you do, congratulations, you are now officially a programmer! 🚀
You have your computer set up correctly, and you've run your first script. Great! In the next chapter we'll set up your project to download a website's HTML using Node.js instead of a browser.