Using NPM I Puppeteer –save Due to various reasons, the NPM, CNPM, and YARN installation fails.

Here is another approach: NPM I –save puppeteer-core

Then go to the chrome installation directory (Windows, Linux, Mac)

In the Windows directory is: C: / Program Files (x86)/Google/Chrome/Application/Chrome. Exe

Sample code:

 const fs = require('fs');
 const path = require('path');
 const puppeteer = require('puppeteer-core'); 

// Execute entry
(async() = > {const browser = await puppeteer.launch({
    headless: false.// Note here that the path points to the executable browser
    executablePath: path.resolve('C:/Program Files (x86)/Google/Chrome/Application/chrome.exe')});const page = await browser.newPage();
  for (let index = 1; index < 50000; index++) {
    await page.waitFor(1000);
    await page.goto('https://juejin.cn/post/6844903832489558029');
    await page.goto('https://juejin.cn/post/6844903811589341198');
    await page.goto('https://juejin.cn/post/6844903732488978440');
    console.log('the first' + index + 'time'); } browser.close(); }) ();Copy the code

The attached:

The Puppeteer API address

The Puppeteer making address