i am making a desktop application using electron and giving the output using puppeteer in pdf
my puppeteer work as expected while i run it using npm and it also runs fine when i package it using electron-forge package in my machine but it gives me this error
Error: Could not find Chrome (ver. 124.0.6367.91). This can occur if either
- you did not perform an installation before running the script (e.g.
npx puppeteer browsers install chrome
) or - your cache path is incorrectly configured (which is: C:Usersadmin.cachepuppeteer).
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.
at ChromeLauncher.resolveExecutablePath (C:UsersadminDesktopsahacharya_fii_billgenerator-win32-x64resourcesapp.asarnode_modulespuppeteer-corelibcjspuppeteernodeProductLauncher.js:295:27)
at ChromeLauncher.executablePath (C:UsersadminDesktopsahacharya_fii_billgenerator-win32-x64resourcesapp.asarnode_modulespuppeteer-corelibcjspuppeteernodeChromeLauncher.js:209:25)
at ChromeLauncher.computeLaunchArguments (C:UsersadminDesktopsahacharya_fii_billgenerator-win32-x64resourcesapp.asarnode_modulespuppeteer-corelibcjspuppeteernodeChromeLauncher.js:89:37)
at async ChromeLauncher.launch (C:UsersadminDesktopsahacharya_fii_billgenerator-win32-x64resourcesapp.asarnode_modulespuppeteer-corelibcjspuppeteernodeProductLauncher.js:70:28)
at async generatePDF (C:UsersadminDesktopsahacharya_fii_billgenerator-win32-x64resourcesapp.asarmain.js:560:25)
at async C:UsersadminDesktopsahacharya_fii_billgenerator-win32-x64resourcesapp.asarmain.js:508:25
at async WebContents. (node:electron/js2c/browser_init:2:82793)
when i copy the packged application to another machine or i make a distributable file and install it using electron-forge make . i have tried setting executable chrome path like this const browser = await puppeteer.launch({ executablePath: myPath });
and also tried making .local-chromium file in puppeteer. It all works fine when i package it in my machine and run it in my machine but it again gives me the above error when i try it on any other machine
i tried setting executable path but it gave error path should be in string format even though it was in a string format in while packaging it i tried specifing chromium versiuon in the forge.config.js file and also tried creating .local-chromium folder in puppeteer node_modules folder and copying chrome in it
kaushik balamurali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.