Skip to content

Windows Lighthouse error: Error: EPERM, Permission denied: ... temp directory ... at rmSync ... at Launcher.destroyTmpΒ #355

@AndreiTelteu

Description

@AndreiTelteu

Hi. I tried using lighthouse-mcp on windows and it crashes when getting the result. The results are generated in a temporary folder but it crashes after "LH:status Generating results..."

Here is the last lines of the log with the stacktrace of the error:

2025-09-24 22:35:38.347 | [info] MCP [pid: 95860] stderr: Lighthouse MCP server running on stdio
2025-09-24T19:34:28.971Z LH:config:warn unrecognized category in 'onlyCategories': pwa
2025-09-24T19:34:29.048Z LH:status Connecting to browser
2025-09-24T19:34:29.053Z LH:status Navigating to about:blank
2025-09-24T19:34:29.057Z LH:status Benchmarking machine
2025-09-24T19:34:30.061Z LH:status Host device pixel ratio
2025-09-24T19:34:30.061Z LH:status Preparing target for navigation mode
2025-09-24T19:34:30.073Z LH:status Cleaning origin data
2025-09-24T19:34:30.084Z LH:status Cleaning browser cache
2025-09-24T19:34:30.118Z LH:status Preparing network conditions
2025-09-24T19:34:30.156Z LH:status Navigating to https:// - redacted - 
2025-09-24T19:34:33.781Z LH:status Getting artifact: DevtoolsLog
2025-09-24T19:34:33.781Z LH:status Getting artifact: Trace
2025-09-24T19:34:33.781Z LH:status Getting artifact: Accessibility
2025-09-24T19:34:33.906Z LH:status Getting artifact: AnchorElements
2025-09-24T19:34:33.970Z LH:method <= browser ERR:error DOM.pushNodeByPathToFrontend 
2025-09-24T19:34:33.971Z LH:method <= browser ERR:error DOM.pushNodeByPathToFrontend 
..... a lot ......
2025-09-24T19:35:38.017Z LH:status Auditing: Optimize DOM size
2025-09-24T19:35:38.018Z LH:status Auditing: Duplicated JavaScript
2025-09-24T19:35:38.018Z LH:status Auditing: Font display
2025-09-24T19:35:38.019Z LH:status Auditing: Forced reflow
2025-09-24T19:35:38.019Z LH:status Auditing: Improve image delivery
2025-09-24T19:35:38.020Z LH:status Auditing: INP breakdown
2025-09-24T19:35:38.023Z LH:status Auditing: LCP breakdown
2025-09-24T19:35:38.024Z LH:status Auditing: LCP request discovery
2025-09-24T19:35:38.025Z LH:status Auditing: Legacy JavaScript
2025-09-24T19:35:38.025Z LH:status Auditing: Modern HTTP
2025-09-24T19:35:38.026Z LH:status Auditing: Network dependency tree
2025-09-24T19:35:38.026Z LH:status Auditing: Render blocking requests
2025-09-24T19:35:38.027Z LH:status Auditing: 3rd parties
2025-09-24T19:35:38.032Z LH:status Auditing: Optimize viewport for mobile
2025-09-24T19:35:38.032Z LH:status Generating results...
Lighthouse error: Error: EPERM, Permission denied: \\?\C:\Users\Andrei\AppData\Local\Temp\lighthouse.99380144 '\\?\C:\Users\Andrei\AppData\Local\Temp\lighthouse.99380144'
    at rmSync (node:fs:1248:18)
    at Launcher.destroyTmp (C:\Users\Andrei\AppData\Local\npm-cache\_npx\c0b21ac6fcf0b232\node_modules\chrome-launcher\dist\chrome-launcher.js:330:9)
    at Launcher.kill (C:\Users\Andrei\AppData\Local\npm-cache\_npx\c0b21ac6fcf0b232\node_modules\chrome-launcher\dist\chrome-launcher.js:312:14)
    at Object.kill (C:\Users\Andrei\AppData\Local\npm-cache\_npx\c0b21ac6fcf0b232\node_modules\chrome-launcher\dist\chrome-launcher.js:41:18)
    at LighthouseServer.handleRunAudit (file:///C:/Users/Andrei/AppData/Local/npm-cache/_npx/c0b21ac6fcf0b232/node_modules/lighthouse-mcp/build/index.js:139:26) {
  errno: 1,
  code: 'EPERM',
  path: '\\\\?\\C:\\Users\\Andrei\\AppData\\Local\\Temp\\lighthouse.99380144',
  syscall: 'rm'
}

The error seems to come from Launcher.destroyTmp > rmSync

rmSync(this.userDataDir, {recursive: true, force: true, maxRetries: 10});

Lighthouse-mcp uses chromeLauncher like this:
https://github.com/priyankark/lighthouse-mcp/blob/9af89d05eb21d41f1008e8d2c96223d03fa2e9f5/src/index.ts#L160

      const chrome = await chromeLauncher.launch({ chromeFlags: ['--headless'] });

I am providing chrome path environment variable because otherwise it says chrome not installed.

      "CHROME_PATH": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"

I tried fixing permissions but they are fine. I added Everyone with full access.
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions