Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save casamia918/031199ff5e015c56f87088765b047526 to your computer and use it in GitHub Desktop.
Save casamia918/031199ff5e015c56f87088765b047526 to your computer and use it in GitHub Desktop.
node.js) ENOENT, no such file or directory when using fs.createWriteStream

If you are facing the "ENOENT, no such file or directory" error message when using fs.createWriteStream, check your file name again.

In my case, the last character is not the last character of file name, but carrage return (\r)

I lost 3 hours to find this simple answer. So I leave this memo.

@andrej-vasilj
Copy link

Also keep in mind that it won't create directories for you. This means that if you have any directories within the file path that don't exist it will throw this error.

@omchiii
Copy link

omchiii commented Apr 13, 2022

Also keep in mind that it won't create directories for you. This means that if you have any directories within the file path that don't exist it will throw this error.

thanks m8 , saved me a lot of time

@m1nka
Copy link

m1nka commented May 21, 2022

Also keep in mind that it won't create directories for you. This means that if you have any directories within the file path that don't exist it will throw this error.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment