最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

node.js - Error: EPERM: operation not permitted while running puppeteer JavaScript node - Stack Overflow

programmeradmin3浏览0评论

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 e back to find that it has pleted 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 plete 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

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 e back to find that it has pleted 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 plete 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
Share Improve this question edited Aug 8, 2020 at 19:21 knowledge_seeker asked Aug 8, 2020 at 18:55 knowledge_seekerknowledge_seeker 9571 gold badge10 silver badges25 bronze badges 2
  • Was the answer provided by @Andris good for you? Please accept if so? I've the same issue. Lots of successes and then a stack of these popup. I cannot do the exclusion list adjustment at my work per IT. I don't believe that is actually the answer though. In our cases it works for thousands and then we're seeing these CrashpadMetrics unlink errors. – Neil Gaetano Lindberg Commented Jun 2, 2021 at 20:22
  • 1 @NeilGuyLindberg I did not attempt to fix the issue using Andris' answer, so I cannot accept it yet. However, I am not entirely sure either that it is the correct answer. – knowledge_seeker Commented Jun 2, 2021 at 21:36
Add a ment  | 

2 Answers 2

Reset to default 4

For me worked doing this

While this is annoying behaviour, there is a workaround: close all pages before closing the browser

let pages = await browser.pages(); await Promise.all(pages.map(page =>page.close())); await browser.close();

https://www.gitmemory./issue/puppeteer/puppeteer/6563/739149056

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.

发布评论

评论列表(0)

  1. 暂无评论