Lighthouse CI failing when running 2nd test due to Eperm issues

17 hours ago 3
ARTICLE AD BOX

I am using Lighthouse CI in Node to scan my site and write some reports.

Whenever I run Lighthouse consecutively, eg with multiple runs or against multiple URLs, I get an EPERM error:

Runtime error encountered: EPERM, Permission denied: \\?\C:\Users\me\AppData\Local\Temp\lighthouse.75127486 '\\?\C:\Users\me\AppData\Local\Temp\lighthouse.75127486' Error: EPERM, Permission denied: \\?\C:\Users\me\AppData\Local\Temp\lighthouse.75127486 '\\?\C:\Users\me\AppData\Local\Temp\lighthouse.75127486' at rmSync (node:fs:1206:18)

I'm guessing this is because node/LHCI is having trouble removing the temporary files whilst they're still being used by Chrome.

I've tried running the tests using execSync but with no luck - same results.

I've also tried setting a different temp folder with the setting

chromeFlags: "--user-data-dir=./tmp"

without success.

Would anyone know what I can do?

My Lighthouserc.js file is:

module.exports = { ci: { collect: { url: [ "https://www.thissite.com/", "https://www.thissite.com/page-1/", ], numberOfRuns: 1, settings: { onlyCategories: ["performance"] } }, upload: { target: 'filesystem', outputDir: './reports' }, }, };
Read Entire Article