Path obtaining issue

I need to store files in ./output/public and get them after storing. Also i have to mount my file-storage by setting absolute path of public dir (in prod it is /output/public). On other hosting platforms my path ‘path.join(process.cwd(), ‘.output/public’)’ works fine, but on vercel i always get the issue of unknown dir, mkdir /vercel. I tried to use __dirname instead of process.cwd and etc. All these ways dont work with vercel. Someone, help me

Hey @roman3205! process.cwd() is the right thing to use.

Here’s a guide that covers the topic in more detail:

thanks, but i get an error like
ENOENT: no such file or directory, mkdir ‘/vercel’

I think that I misunderstood your situation at first. The project would be able to read files that already exist from the build, but cannot write additional files after deployment. Instead, you would need to use a storage service such as Vercel Blob or AWS S3.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.