Skip to content

ENOENT Error When Recovering Source Files #6

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

Open
mSharif10 opened this issue Feb 27, 2025 · 0 comments
Open

ENOENT Error When Recovering Source Files #6

mSharif10 opened this issue Feb 27, 2025 · 0 comments

Comments

@mSharif10
Copy link

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! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant