Skip to content

ENOENT Error When Recovering Source FilesΒ #6

@mSharif10

Description

@mSharif10

When running recover-source script, the tool throws an ENOENT: no such file or directory error while trying to write a file with a query string in the filename. The issue appears to be caused by an invalid file path due to a query parameter (?6e4c) being appended to the filename.

Error Log

...
...
Source code recovered to checkCircle.svg
Source code recovered to resend.svg
Source code recovered to index.tsx
node:fs:2426
    return binding.writeFileUtf8(
                   ^

Error: ENOENT: no such file or directory, open 'C:\Users\Myterious\Downloads\tmp\style.module.css?6e4c'
    at Object.writeFileSync (node:fs:2426:20)
    at C:\Users\Myterious\AppData\Roaming\npm\node_modules\recover-source\index.js:47:24
    at SourceMapConsumer.with (C:\Users\Myterious\AppData\Roaming\npm\node_modules\recover-source\node_modules\source-map\lib\source-map-consumer.js:70:20)
    at async handleFile (C:\Users\Myterious\AppData\Roaming\npm\node_modules\recover-source\index.js:33:5) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'C:\\Users\\Myterious\\Downloads\\tmp\\style.module.css?6e4c'
}

Node.js v22.14.0

Steps to Reproduce

  1. Install recover-source globally:

    `npm install -g recover-source`
    
  2. Run recover-source on a .map file that contains query parameters in its source paths.

like for example in my case the .map file contains "webpack://myappwapi-web/./src/Components/Pages/stickyChat/CustomMessageItem/CustomContactItem.tsx/style.module.css?6e4c"

Environment
OS: Windows 11
Node.js version: v22.14.0

Possible Fix

  • The tool should sanitize file paths before writing to disk.
  • If query parameters exist in the filename, they should be stripped out.

Would appreciate any fix or workaround for this! πŸš€

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions