Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.
TypeScript apifyautomationcrawlercrawlingheadlessheadless-chromejavascriptnodejsnpmplaywrightpuppeteerscraperscrapingtypescriptweb-crawlerweb-crawlingweb-scraping
Fixing error message when puppeteer is not found
Marek Trunkat317d0c0c7752
diff --git a/src/puppeteer.js b/src/puppeteer.jsindex a62858277..ff7bf3a7c 100644--- a/src/puppeteer.js+++ b/src/puppeteer.js@@ -4,7 +4,7 @@ import { anonymizeProxy, closeAnonymizedProxy, redactUrl } from 'proxy-chain';import log from 'apify-shared/log';import { ENV_VARS } from 'apify-shared/consts';import { DEFAULT_USER_AGENT } from './constants';-import { newPromise, getTypicalChromeExecutablePath } from './utils';+import { newPromise, getTypicalChromeExecutablePath, isAtHome } from './utils';import { getApifyProxyUrl } from './actor';import { registerBrowserForLiveView } from './puppeteer_live_view_server';@@ -118,7 +118,11 @@ const getPuppeteerOrThrow = () => {// This is an optional dependency because it is quite large, only require it when used (ie. image with Chrome)return require('puppeteer'); // eslint-disable-line global-require} catch (err) {- if (err.code === 'MODULE_NOT_FOUND') err.message = 'Cannot find module \'puppeteer\'. Did you choose the correct base Docker image?';+ if (err.code === 'MODULE_NOT_FOUND') {+ err.message = isAtHome()+ ? 'Cannot find module \'puppeteer\'. Did you choose the correct base Docker image (apify/node-chrome-*)?'+ : 'Cannot find module \'puppeteer\'. Did you you install \'puppeteer\' package?';+ }throw err;}