New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EPERM error attempting to run example #298
Comments
Speculating: you might've accidentally launched the script twice, and two parallel puppeteers tried to run chrome with the same profile folder - We should generate profile folder names randomly so that parallel runs of puppeteer work fine. |
It's possible! Seems unlikely though as I was launching node via the CLI and not doing anything different beyond originally setting |
+1 |
Hi, |
I've been running into this problem as well, though with an even simpler example script that just launches the browser and then immediately tries to close it: const puppeteer = require('puppeteer');
(async () => {
console.log("Launching browser.");
const browser = await puppeteer.launch();
console.log("Closing browser.");
browser.close();
})(); I've tried manually deleting the As a workaround, I've found that simply calling |
I was seeing this the first couple times I ran the usage demo, but I didn't get it every time. About ten minutes later, I see far more successes than errors running the script. I'm not sure if that helps or not. |
same problem, windows 10, node v7.10.0, puppeteer 1.0.0. setting DEBUG=* doesn't help, tried running as admin
|
+1 |
same problem, windows 10, node v8.4.0, puppeteer 0.9.0 |
Everybody: could you please check if tip-of-tree puppeteer works for you? There have been some changes that might address this. |
Windows 7 x64, Node .js 8.4.0. (node:1040) UnhandledPromiseRejectionWarning:
Unhandled promise rejection (rejection id: 1):
Error: EPERM: operation not permitted,
unlink 'c:\Windows\Temp\puppeteer_dev_profile-dgXrpD\CrashpadMetrics-active.pma'
(node:1040) [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. Profile folders remain in the |
Each folder contains 2 files with a lock sign (access for system and admins only):
|
I didn't have any issues when I installed from latest. Caveat: I used a very different setup than what I had when I posted on this issue. At that time, I was integrating Puppeteer into an existing project, and after I got the error a couple of times, it just stopped erroring for some reason. However, I wanted to give this update a test. I figured creating a new project was the easiest way to test this. I created a new project. I installed with |
FWIW: 'use strict';
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
try { await browser.close(); } catch (err) { console.log(err); }
})(); { Error: EPERM: operation not permitted,
unlink 'c:\Windows\Temp\puppeteer_dev_profile-BzkIJu\CrashpadMetrics-active.pma'
at Object.fs.unlinkSync (fs.js:1067:18)
at fixWinEPERMSync (...\node_modules\rimraf\rimraf.js:210:13)
at rimrafSync (...\node_modules\rimraf\rimraf.js:310:28)
at ...\node_modules\rimraf\rimraf.js:341:5
at Array.forEach (<anonymous>)
at rmkidsSync (...\node_modules\rimraf\rimraf.js:340:26)
at rmdirSync (...\node_modules\rimraf\rimraf.js:333:7)
at fixWinEPERMSync (...\node_modules\rimraf\rimraf.js:208:5)
at rimrafSync (...\node_modules\rimraf\rimraf.js:310:28)
at killChromeAndCleanup (...\node_modules\puppeteer\lib\Launcher.js:103:7)
errno: -4048,
code: 'EPERM',
syscall: 'unlink',
path: 'c:\\Windows\\Temp\\puppeteer_dev_profile-BzkIJu\\CrashpadMetrics-active.pma' } |
I am getting the same unlink error on CrashpadMetrics-active.pma. Windows 7 Pro machine with fresh installs of Node 8.4.0 and puppeteer 0.9.0 from yesterday. |
Seems to be fixed for me (Windows 7 x64) after ac109db |
Yes, should be fixed now. |
I got same problem with default chromium instillation with puppeteer but I solved by using chrome instead of the chromium |
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 |
+1 |
I am closing all the pages before closing browser, but still seeing this issue. Anyone else the same? |
i have same problem with multiples open and close chromium, i think it's concurrence |
I ended up fixing it in a somewhat ugly way by doing |
Yes the drawback is that it's not documented in the api and it's a
workaround not a solution. The puppeteer dev team should push a fix. Thanks
anyway for the notice :-)
…On Fri, Dec 18, 2020, 06:03 caihongxu ***@***.***> wrote:
I ended up fixing it in a somewhat ugly way by doing
browser.process().kill('SIGKILL'); instead of await browser.close(); And
the issue never happended again. Any drawbacks of this?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#298 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACLIE5B26YARSKBV22ZNKATSVLPBJANCNFSM4DXFG7VQ>
.
|
await browser.close()
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. |
Hello, |
+1 |
+1 |
Using browser.process().kill() had been working well for me so far (since the last time I posted). Note that in order for this to work you need to remove both browser.close() and page.close() code, otherwise you will still get stuck. |
Closing all browser pages before invoking close() worked for me (thanks @ CreativeBuilds) const pages = await browser.pages();
await Promise.all(pages.map(page => page.close()));
await browser.close(); |
Not working for me :( |
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. |
+1 |
The workaround isn't working for me, I believe the reproduction of this bug is dependent on how fast the computer is. const puppeteer = require('puppeteer');
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
(async () => {
while (true) {
console.log('launching');
const browser = await puppeteer.launch({ headless: false, args: ['--no-sandbox'] });
console.log('sleeping');
await sleep(1000);
console.log('closing pages');
await Promise.all((await browser.pages()).map(async page => await page.close()));
console.log('closing');
await browser.close();
console.log('sleeping');
await sleep(1000);
}
})(); I believe the A possible solution (which is bad but works) is to increase |
Disabling crashpad is actually not working, so not solving the initial issue |
Removing "args: ["--no-sandbox"]" from my "jest-puppeteer.config.js" file, module.exports object makes this work on windows 10. My module.exports now looks like: module.exports = { my package.json looks like: { |
Still not work for me, I've tried all approach above, but no one work for me :( |
I had the exact same situation and this seems to have worked for me |
#6946 is the only real fix short of switching away from Windows. |
Fix for: puppeteer#6946, puppeteer#298 etc. (MAJOR PRIORITY) Problem description: WINDOWS ONLY! Any process involving this library would completely crash ungracefully if browser.close() is unable to delete the /temp/ folder, because the promise never gets fulfilled or rejected. Problem tends to happen on slower computers/VMs or environments with limited access to appdata/local folder. Issue can be hard to reproduce in a lot of cases. Solution: fulfill() in catch for removeFolderAsync(this._tempDirectory) Alternative solutions: - SIMPLE, but not ideal: throw(error) instead, remove console.error(error). - HARDER, ideal: add WORKING runtime arguments to disable Crashpad-Metrics.
I use
Thank you. This is working for me. |
I would like to report that, while this fix works (I prefer resolved vs rejected) and doesn't hang the browser, there is still a lot of instability caused by removing the temporary directory. Our production service on Windows crashes ever so often due to that. Right now the way we patched this is to schedule ( |
@MahbbRah sadly doesn't work. This is not user profile but crashpad and metrics. |
For me as well it didn't work. the issue is it kept working suddenly got that bug again. But Yes I fixed it for my case it was this issue and this way I solved it. |
Hello, I know it's not the prettiest thing, but I managed to solve this error using the home page that is created when using "puppeteer.launch()" instead of creating a new page, I changed: const page = wait browser.newPage(); for: const pages = await browser.pages(); By Cromium's rule, if all tabs/pages are closed it will also close so you don't need to use the command "await browser.close()" |
Trying to run the following code:
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
The text was updated successfully, but these errors were encountered: