Next.js Discord

Discord Forum

Trouble with path for vercel deployment

Answered
remii posted this in #help-forum
Open in Discord
Previously posted here asking for help on pathing my local fonts (answered).
#Trouble with path for next/font/local

With this solution however, the vercel deployment is failing with
Module not found: Can't resolve '../../../public/public/fonts/helveticaneue-light.otf'

I think I should mention that during setup i kept everything regarding what the root directory was at default (./)
The github repo used in the previous forum is also the same file structure as my current development repo
Answered by Anay-208 | Ping in replies
../../../public/fonts/helveticaneue-light.otf
View full answer

19 Replies

Attempting other file paths that have failed:

Code: "/public/fonts/helveticaneue-light.otf"

Vercel Error:
Module not found: Can't resolve './/public/fonts/helveticaneue-light.otf'
@Anay-208 | Ping in replies make sure you're using `..` to go back a foler
public/fonts/helveticaneue-light.otf
The path needs to be absolute
@remii public/fonts/helveticaneue-light.otf
If your file is in src/app/layout.tsx, you have to prefix “../../“ to the path
hmm i think understand what your saying
i have all my fonts in fonts.ts which has a path src/app/ui/fonts.ts
@Anay-208 | Ping in replies If your file is in src/app/layout.tsx, you have to prefix “../../“ to the path
so the absolute prefix would be "../../../" correct?
granted i also just tried ur suggested path an it still gave the vercel error
@remii granted i also just tried ur suggested path an it still gave the vercel error
Can you share screenshot of your project structure
@Anay-208 | Ping in replies Can you share screenshot of your project structure
../../../public/fonts/helveticaneue-light.otf
Answer
I’m error if you see, you added public twice
💀 im unserious lol. preciate it, its deployed