Error: EPERM: operation not permitted while running puppeteer JavaScript node

Viewed 3724

I have a script which scrapes through several URLs in an infinite loop and notifies me of any changes to the website. Every time I leave it running for a while, I come back to find that it has completed tens/hundreds of iterations of the loop, but I eventually this error.

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

This error does not appear to happen on a particular line, because as mentioned the script has been through several complete iterations of the loop before getting this error.

I googled this error, but it seems that people are only really experiencing it with NPM or if they do experience it with puppeteer it is on a particular line of their code. When I read the .pma file using an online .pma reader this is the message I got:

 CrashpadMetrics UMA.PersistentAllocator.CrashpadMetrics.UsedPct UMA.PersistentAllocator.CrashpadMetrics.Errors Crashpad.HandlerLifetimeMilestone Stability.BrowserExitCodes
2 Answers

If you're running this on Windows to me in a similar situation the solution was to add the node process to the exclusion list of Windows Security. I think it's preventing access to some temp file and node fails on that.

Related