zfcsoftware / puppeteer-real-browser

This package is designed to bypass puppeteer's bot-detecting captchas such as Cloudflare. It acts like a real browser and can be managed with puppeteer.
https://www.npmjs.com/package/puppeteer-real-browser
MIT License
359 stars 45 forks source link

ChromePathNotSetError The CHROME_PATH environment variable must be set to a Chrome/Chromium executable no older than Chrome stable. #81

Open CenkkD opened 4 days ago

CenkkD commented 4 days ago

`ChromePathNotSetError at new LauncherError (file:///root/node_modules/chrome-launcher/dist/utils.js:22:22) at new ChromePathNotSetError (file:///root/node_modules/chrome-launcher/dist/utils.js:28:9) at Module.linux (file:///root/node_modules/chrome-launcher/dist/chrome-finder.js:124:15) at Launcher.getFirstInstallation (file:///root/node_modules/chrome-launcher/dist/chrome-launcher.js:122:43) at Launcher.launch (file:///root/node_modules/chrome-launcher/dist/chrome-launcher.js:190:43) at launch (file:///root/node_modules/chrome-launcher/dist/chrome-launcher.js:33:20) at file:///root/node_modules/puppeteer-real-browser/src/module/chromium.js:70:32 at new Promise () at startSession (file:///root/node_modules/puppeteer-real-browser/src/module/chromium.js:24:12) at file:///root/node_modules/puppeteer-real-browser/src/index.js:53:62 { message: 'The CHROME_PATH environment variable must be set to a Chrome/Chromium executable no older than Chrome stable.', code: 'ERR_LAUNCHER_PATH_NOT_SET' } file:///root/node_modules/puppeteer-real-browser/src/module/chromium.js:95 throw new Error(err.message) ^

Error: The CHROME_PATH environment variable must be set to a Chrome/Chromium executable no older than Chrome stable. at file:///root/node_modules/puppeteer-real-browser/src/module/chromium.js:95:19 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v21.7.3 `

We tried both in Almalinux 9 and Ubuntu 22. But we got this error when we try to use.

EgglezosK commented 4 days ago

@CenkkD Its not provlem of the library, its problem of your system installation. You must install chromium or chrome on your machine.

Follow these steps:

  1. wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
  2. sudo apt update
  3. sudo apt install ./google-chrome-stable_current_amd64.deb

Try see the version after installation:

(optional): /usr/bin/google-chrome --version

  1. finally: export CHROME_PATH="/usr/bin/google-chrome" # For Google Chrome

Ready to go!

tfa346 commented 3 days ago

Thanks for the answer @EgglezosK, so if we need to do that, the plugin cannot be used on AWS Lambda?

EgglezosK commented 3 days ago

Thanks for the answer @EgglezosK, so if we need to do that, the plugin cannot be used on AWS Lambda?

After a quick research foudn that on AWS Lambda isn't so easy - straightforward to install software etc. but i found this one:

https://www.npmjs.com/package/chrome-aws-lambda https://github.com/alixaxel/chrome-aws-lambda

Give a try, with npm i -g to store it on your system and set is as variable to your system.

something like that: export CHROME_PATH="/usr/bin/node/node-modules/chromium"

PS: is a little bit old version of chromium ~3 years ago