0

this is my code:

const puppeteer = require('puppeteer');

(async()=>{
    const browser = await puppeteer.launch({
        executablePath:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
        headless:false,
        args:['--user-data-dir=/tmp/puppeteer_dev_chrome_profile-CGzsOE/'],
        ignoreDefaultArgs: true
    })
    const page = await browser.newPage()
    page.goto("https://www.google.com")
})()

when I run my js file, I receive this error:

(node:522) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
[14964:4488:0907/043929.675:ERROR:cache_util_win.cc(21)] Unable to move the cache: Access is denied. (0x5)
[14964:4488:0907/043929.675:ERROR:cache_util.cc(139)] Unable to move cache folder C:\Users\dabas\AppData\Local\BraveSoftware\Brave-Browser\User Data\ShaderCache\GPUCache to C:\Users\dabas\AppData\Local\BraveSoftware\Brave-Browser\User Data\ShaderCache\old_GPUCache_000
[14964:4488:0907/043929.675:ERROR:disk_cache.cc(184)] Unable to create cache
[14964:4488:0907/043929.675:ERROR:shader_disk_cache.cc(606)] Shader Cache Creation failed: -2


TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

    at onClose (/mnt/c/Users/dabas/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
    at ChildProcess.helper_js_1.helper.addEventListener (/mnt/c/Users/dabas/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:184:79)  
    at ChildProcess.emit (events.js:203:15)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
(node:522) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:522) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

and another pop-up error saying:

Brave cannot read and write to its Data directory
/tmp/puppeteer_dev_chrome_profile-CGzsOE

I really need help in fixing this, I've tried a lot of stuff already such as not specifying a data directory but nothing is working.

Jammooly
  • 43
  • 6
  • have you check the permissions of the directory ? This question seem to have be of a similar issue: https://stackoverflow.com/questions/37317427/unable-to-move-the-cache-error-in-selenium-webdriver – kigiri Sep 07 '20 at 22:20
  • Yes I have, I even did 'chmod 777' to the directory. I also tried the script without specifying the directory, meaning I didn't have an args parameter. When I didn't have an args parameter, it generates a new puppeteer_dev_chrome_profile in the error message each time despite not existing in my /tmp/ folder. – Jammooly Sep 08 '20 at 04:50

0 Answers0