![]() This tutorial was tested on Node.js version 12.18.3 and npm version 6.14.6. You can follow this guide to install Node.js on macOS or Ubuntu 18.04, or you can follow this guide to install Node.js on Ubuntu 18.04 using a PPA. With Node.js installed, you can begin setting up your web scraper. First, you will create a project root directory and then install the required dependencies. npm comes preinstalled with Node.js, so you don’t need to install it.Ĭreate a folder for this project and then move inside: This tutorial requires just one dependency, and you will install it using Node.js’s default package manager npm. You will run all subsequent commands from this directory. We need to install one package using npm, or the node package manager. First initialize npm in order to create a packages.json file, which will manage your project’s dependencies and metadata. You can press ENTER to every prompt, or you can add personalized descriptions. Make sure to press ENTER and leave the default values in place when prompted for entry point: and test command. "test": "echo \"Error: no test specified\" & exit 1" Your output will look something like this: Alternately, you can pass the y flag to npm- npm init -y-and it will submit all the default values for you. npm will save this output as your package.json file. This command installs both Puppeteer and a version of Chromium that the Puppeteer team knows will work with their API. ![]() On Linux machines, Puppeteer might require some additional dependencies. You can use the following command to help find any missing dependencies: If you are using Ubuntu 18.04, check the ‘Debian Dependencies’ dropdown inside the ‘Chrome headless doesn’t launch on UNIX’ section of Puppeteer’s troubleshooting docs.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |