Can't find file when trying to export to csv 'message: "ENOENT: no such file or directory, open '/public/downloads/export.csv'"

Hey all,

Followed the necessary steps to download data to an excel, I’ve created the folder, and the file and selected this as the path for the excel file, and made sure overwrite is not selected, so it should just create a new csv, instead I keep getting this error:

  1. message: “ENOENT: no such file or directory, open ‘/public/downloads/export.csv’”

I’ve tried creating new folders, i’ve tried matching the file name with the chosen file in the export folder, i’ve tried a file in the public folder, and non public folder (which is preferred), i’ve made sure I’ve deployed with the new folders to ensure Docker has them - no luck!

NodeJS/Docker project.

Any ideas what I’m doing wrong here?

Team - is this a bug, or am I getting something wrong in the flow to get this output?

Yes, looks like a bug. Still investigating, will post an update later.

1 Like

Ok, thank you for letting me know.

Here an update, place the file in lib/modules. (1.0 KB)

Thanks @patrick - this appears to have solved the initial issue, but I now ave another:

  1. stack: “Error: EEXIST: file already exists, open ‘/opt/node_app/public/downloads/export.csv’”

Noting I have not selected to ‘overwrite’ as I want a new file to be created each time.

To add to this, it also doesn’t seem possible to trigger a ‘download’ of that file in the browser. I’m using ‘overwrite’ to get the file to export (noting I don’t want to do that but it errors otherwise) then download file action - the contents are downloaded in some format in dev tools but no actual file download is triggered.

Just bumping this @patrick

@patrick strangely the initial problem has now returned as well, perhaps the 3.3.6 overwrote your fix? Can you please let me know re: both, as currently I’m not able to export to csv, or download the file in the users browser.

Does it work when you replace the file again with the one I posted in this topic? The file was indeed updated with 3.3.6 and probably replaced your file, but should include your fix also. There were also several other updates that maybe conflicted with your fix. Will investigate it, please confirm if the previous file I’ve send fixes it again.

Hey @patrick - I’ve just replaced the file with the updated file in this thread - I’m still experiencing the same original issue where the file cannot be found.

Worth noting, when it worked with the updated file, I was still not able to download the file after exporting to the excel, stating file already exists. - see second issue on this thread, please.

Hey @patrick any update on these two?

I tested it myself and did not experience any problems with the latest version. Does the folder where you write the csv exist? Does a csv file exist with the same name and do you use the overwrite option? What is the exact error that you are getting when file exists and when there is no file?

Here just in case the file I tested it with: (1.0 KB)

Hey @patrick- Yep folder and file exists. I had it working with overwrite but I don’t want to overwrite and when I try to not overwrite it fails (as per second report in thread) I want to create a new file - however now the export csv is not even working for me…


Tested again today, and can confirm it does not work.

I have tried to export the CSV with overwrite checked, and unchecked. With ‘contains headers’ and without. I am selecting the file path from within the Wappler UI, so the path/file exist as I’m using Wappler to select it.

1. {status: "500", code: "ENOENT",…}

  1. code: "ENOENT"
  2. message: "ENOENT: no such file or directory, open '/opt/node_app/batch/batchEnrich/outputs/batchSocialProfileURLOutput.csv'"
  3. stack: "Error: ENOENT: no such file or directory, open '/opt/node_app/batch/batchEnrich/outputs/batchSocialProfileURLOutput.csv'"
  4. status: "500" 

Note: This is just for the ‘export CSF File’ part. Once this doesn’t throw an error I’ll need to then download the file in the users browser. Prior to this stopping working (it worked previously using overwrite file check) - it then failed on the file download.

Please advise.


It is very strange, I tested it and it just creates the file when it doesn’t exist. If I have overwrite unchecked and the file exists then I get an error EEXIST: file already exists. In all other scenarios it just writes the file correctly.

Does the full path exist and does node have write permissions there?

Hi @patrick

So I was able to take this a step further - the folder was not in /Public - so I moved it there for testing (based on your suggestion around permissions).

I am now able to ‘overwrite’ the file in the folder again by checking the overwrite.

However, I don’t want to do that - I want to generate a new CSV file with unique file name that I can then provide as a file for the user to download - either triggered automatically once complete or via a unique link.

If I uncheck ‘Overwrite’ then I get this error:

My understanding is that within the Wappler UI, we choose the file path (not folder, but the actual file - it will not allow me to choose just a folder) in the path when using ‘Export CSV file’

Once we choose the file, we can then choose to overwrite it (which appears to work) - or, create a totally new file if we remove the check from overwrite.

However, creating a new file is not possible - as we have to select the file in the folder, and then naturally the system errors and tells me this exists already - because it does.

What’s the workaround here please Patrick? If I could just select the folder in the path that would solve it - but I am forced to select the file.

I even tried selecting the file within Wappler so it generates the path, then I removed the actual ending file name leaving just th folder path - but I get the same error.

It seems there is no possible way to create a new file using Export CSV. Please advise?

The export doesn’t have an option to generate a unique name, you could change the path to something like /public/export/{{TIMESTAMP}}.csv for generating a unique filename.

Thank you @patrick - that has solved it!