0

Sometimes I've been getting this error while using puppeteer but since I haven't found a way around it. I just wrote code that will unlink it after the browser closes. Although sometimes Puppeteer will crash the whole process when this happens. Is there a way to detect this crash and be able to do error handling?

[Error: EPERM: operation not permitted, unlink 'C:\Users\user\AppData\Local\Temp\puppeteer_dev_chrome_profile-8gwzA9\CrashpadMetrics-active.pma'] {
  errno: -4048,
  code: 'EPERM',
  syscall: 'unlink',
  path: 'C:\\Users\\user\\AppData\\Local\\Temp\\puppeteer_dev_chrome_profile-8gwzA9\\CrashpadMetrics-active.pma'
}

Right now I'm using child.on("error", exithandler) but it doesn't seem to work on this error.

var child = spawn(process.execPath, [__filename, "child"], {
                stdio: ["inherit", "inherit", "inherit", "ipc"],
            });

child.on("error", (err) =>{
      console.log(`process ${child.pid} crashed with error: ` + err)
})
Mo K
  • 45
  • 6
  • Does this [answer](https://stackoverflow.com/a/42262771/8153505) answers your question? It said that surround your code with `try` `catch`. – namgold Aug 13 '21 at 05:59
  • I've been trying to test it for the last 30 minutes and it seems like just doing a try-catch block doesn't catch the error – Mo K Aug 13 '21 at 06:35

0 Answers0