puppeteer: EPERM error attempting to run example
Trying to run the following code:
var puppeteer = require("puppeteer");
puppeteer.launch().then(async browser => {
let page = await browser.newPage();
await page.goto('https://google.com');
await page.screenshot({ path: 'screenshot.png' });
browser.close();
});
I got an error:
Error: EPERM: operation not permitted, unlink 'C:\Users\tivac\Desktop\puppeteer-testing\node_modules\puppeteer\.dev_profile1\CrashpadMetrics-active.pma'
In the course of debugging this set DEBUG=*
to try and understand where things were failing, but after doing that it then worked fine. đ
Does the first-run experience not quite work right in non-DEBUG
modes? Iâm not sure, but thatâs what happened for me!
puppeteer@0.9.0
npm@5.3.0
node@8.2.1
- Windows 10 Version 1607 (OS Build 14393.1593)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 9
- Comments: 63 (7 by maintainers)
Commits related to this issue
- Close all open pages before closing the browser. This fixes the permission error on Windows 10. Found others with the [same](https://github.com/puppeteer/puppeteer/issues/298) [issue](https://github.... — committed to denisbrodbeck/eleventy-plugin-social-images by denisbrodbeck 4 years ago
- Fulfill promise on EPERM while deleting temp folder Fix for: #6946, #298 etc. (MAJOR PRIORITY) Problem description: WINDOWS ONLY! Any process involving this library would completely crash ungrac... — committed to bdumitru/puppeteer by bdumitru 3 years ago
Was having an issue with
await browser.close()
but thanks to @ivangergo3âs answer adding a couple lines to close all the pages gets rid of the crash error! đEdit 12/17/2020
let pages = await browser.pages() await Promise.all(pages.map(page =>page.close())) //one closing bracket is missing in the above code await browser.close()
I am closing all the pages before closing browser, but still seeing this issue. Anyone else the same?
Iâm getting this on 5.3.1 as well.
I have a solution, you have to close the page before closing the browser. Of course if you have more pages open, close all of them.
await page.close(); await browser.close();
I started getting this error on a Windows box but it was after other changes I made trying to get puppeteer to run in a Debian VM. One of the things I had to do for Debian was to add ââno-sandboxâ, ââdisable-setuid-sandboxâ arguments. Once I removed those, it started working on Windows again.
I forget the exact reason I had needed to add them to for Debian.
Closing all browser pages before invoking close() worked for me (thanks @ CreativeBuilds)
Hello, Neither closing all pages before closing browser or using
browser.process().kill('SIGKILL');
is working for me. The issue occurs randomly.The workaround isnât working for me, I believe the reproduction of this bug is dependent on how fast the computer is. This is my repro, gets the EPERM after 1-5 loops:
I believe the
headless: false
,--no-sandbox
, closing each page, and also theconsole.log
s, all make the entire thing somehow slower in the right places, and cause the crashpad process to stay alive long enough so thatrimraf
s timeouts and throws the error (about 600ms).A possible solution (which is bad but works) is to increase
rimraf
smaxBusyTries
option so that it would retry a bit more, eventually it works. A better solution is to disable the crashpad process - #2778.Seeing this on 5.3.1 as well
I had the exact same situation and this seems to have worked for me
Hello guys, just had this error in the latest version, in my case it was because I forgot an âawaitâ before a âbrowser.close()â. So you should close the browser like this :My await was already missing before, but It didnât show any error before I installed my project on another computer. So make sure not to forget your awaits just like me đEDIT : Nevermind, it happens randomly even after making sure the await is there. And The issue started appearing on other projects that were fine before.
Same Problem here. [Error: EPERM: operation not permitted, unlink âC:\Users\xxxxxx\AppData\Local\Temp\1\puppeteer_dev_chrome_profile-sj0wiy\CrashpadMetrics-active.pmaâ] { errno: -4048, code: âEPERMâ, syscall: âunlinkâ, path: âC:\Users\xxxxxxx\AppData\Local\Temp\1\puppeteer_dev_chrome_profile-sj0wiy\CrashpadMetrics-active.pmaâ } Can some one open the issue with the dev team?
I am using puppeteer to extract data and push it into a db since the data is more i subdivided the data and running multiple instances in different computers but then i am getting the same error. Please help @aslushnikov
Yes, should be fixed now.