[Bug] Error: An `executablePath` or `channel` must be specified for `puppeteer-core`
See original GitHub issueDescribe the bug
-
Fresh installation with :
npm install puppeteer puppeteer-extra puppeteer-extra-plugin-stealth
-
Copy paste the main from
puppeteer-extra-plugin-stealth
npm -
Start the program with
node index.js
-
I get the error
Error: An 'executablePath' or 'channel' must be specified for 'puppeteer-core'
:
Code Snippet
// puppeteer-extra is a drop-in replacement for puppeteer,
// it augments the installed puppeteer with plugin functionality
const puppeteer = require('puppeteer-extra');
// add stealth plugin and use defaults (all evasion techniques)
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
puppeteer.use(StealthPlugin());
// puppeteer usage as normal
puppeteer.launch({ headless: true }).then(async browser => {
console.log('Running tests..')
const page = await browser.newPage()
await page.goto('https://bot.sannysoft.com')
await page.waitForTimeout(5000)
await page.screenshot({ path: 'testresult.png', fullPage: true })
await browser.close()
console.log(`All done, check the screenshot. ✨`)
});
Versions
System:
OS: Windows 10 10.0.19044
CPU: (8) x64 Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
Memory: 8.58 GB / 15.95 GB
Binaries:
Node: 16.13.2 - D:\Program Files\nodejs\node.EXE
npm: 8.1.2 - D:\Program Files\nodejs\npm.CMD
npmPackages:
puppeteer: ^19.1.0 => 19.1.0
puppeteer-extra: ^3.3.4 => 3.3.4
puppeteer-extra-plugin-stealth: ^2.11.1 => 2.11.1
===================================
Edit
So it seems that puppeteer-core require now the executablePath
as mandatory? I think this is new I never got this error before.
I fixed it by adding the path to the chrome.exe
file:
const os = require("os");
// puppeteer-extra is a drop-in replacement for puppeteer,
// it augments the installed puppeteer with plugin functionality
const puppeteer = require('puppeteer-extra');
// add stealth plugin and use defaults (all evasion techniques)
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
puppeteer.use(StealthPlugin());
// puppeteer usage as normal
puppeteer.launch({ headless: true, executablePath: `${os.homedir()}/.cache/puppeteer/chrome/win64-1045629/chrome-win/chrome.exe`}).then(async browser => {
console.log('Running tests..')
const page = await browser.newPage()
await page.goto('https://bot.sannysoft.com')
await page.waitForTimeout(5000)
await page.screenshot({ path: 'testresult.png', fullPage: true })
await browser.close()
console.log(`All done, check the screenshot. ✨`)
});
Maybe puppeteer-extra could look for the presence of a browser in the cache and automatically find the installed one ? Probably linked with #728
Issue Analytics
- State:
- Created a year ago
- Reactions:8
- Comments:6
Top Results From Across the Web
Puppeteer error: An `executablePath` or `channel` must be ...
It seems like puppeteer-core now requires executablePath as mandatory. Try this: import bypass from './captcha/captchaBypasser.js'; import ...
Read more >Can't use puppeteer-core anymore due to error _projectRoot ...
Bug description I am using Puppeteer within WebdriverIO to run ... or puppeteer.launch with an explicit executablePath or channel option.
Read more >Puppeteer-core NPM
PUPPETEER_EXECUTABLE_PATH - specify an executable path to be used in puppeteer.launch . PUPPETEER_PRODUCT - specify which browser you'd like Puppeteer to use.
Read more >Puppeteer error: An `executablePath` or `channel ... - YouTube
Puppeteer error: An `executablePath` or `channel ` must be specified for `puppeteer - core ` I hope you found a solution that worked...
Read more >Troubleshooting - Puppeteer
The most common cause is a bug in Node.js v14.0.0 which broke extract-zip , the module Puppeteer uses to extract browser downloads into...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks @bribes, this worked for me:
Same here
Edit:
Solutions:
executablePath: require('puppeteer').executablePath()
.