Error: no such file or directory - what's the file structure?

Hi! I'm trying to access locally stored images in my Node project, under /images/. I've tried both process.cwd() and __dirname, but they have the same result of not being able to find the images on railway. Locally on Windows 11 it works fine, but in Railway, it errors
[Error: ENOENT: no such file or directory, stat '/app/images/nonRanked/Duos.png']
[Error: ENOENT: no such file or directory, stat '/app/images/nonRanked/Duos.png']
Am I doing something wrong? I feel like I'm doing something wrong. The code in question is just:
attachment: `${process.cwd()}/images/nonRanked/${mode}.png`,
attachment: `${process.cwd()}/images/nonRanked/${mode}.png`,
Solution:
Nevermind, this was simply a product of me not realizing the image names were wrong :) Carry on
Jump to solution
3 Replies
Percy
Percy2y ago
Project ID: b2bc734b-3a33-43ab-8708-b48b248f39f0
SDCore
SDCoreOP2y ago
b2bc734b-3a33-43ab-8708-b48b248f39f0
Solution
SDCore
SDCore2y ago
Nevermind, this was simply a product of me not realizing the image names were wrong :) Carry on
Want results from more Discord servers?
Add your server