I have an excel file named Words.xlsx
in public directory. Initially, during development mode, setting file path to /public/Words.xlsx
worked fine but it failed in production mode saying that it can't read file path. Then, I read this and changed path to/Words.xlsx
but I am still receiving the same error(below) in my function logs of vercel.
[Error: ENOENT: no such file or directory, open '/Words.xlsx'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/Words.xlsx'
}
ENOENT: no such file or directory, open '/Words.xlsx'
Further, I am using this npm package to read excel file. Below is the code of how I use it:
const res1Sheet = await readXlsxFile('/Words.xlsx', { sheet: 1 });
How do I solve this?
question from:
https://stackoverflow.com/questions/65867765/unable-to-fetch-excel-file-in-production-in-nextjs 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…