trouble deploying
Unanswered
chr.yx posted this in #help-forum
chr.yxOP
I have the nextjs in the frontend sub dir and it has typescript and @types/node. Do i need to install it on the root directory for it to work?
63 Replies
@chr.yx I have the nextjs in the frontend sub dir and it has typescript and @types/node. Do i need to install it on the root directory for it to work?
American Fuzzy Lop
Have you run npm i in the backend folder?
American Fuzzy Lop
No I’ve seen some people do it like this
chr.yxOP
American Fuzzy Lop
Ya this is definitely something I’ve seen
American Fuzzy Lop
It might be due to the —prefix
Can you try rewriting the npm build command without it?
chr.yxOP
ok
would this work:
npm install && cd frontend && npm install && npm run build && cd ..same error
American Fuzzy Lop
I believe you can just use the folder structure in your npm command like
"npm run backend build && npm run frontend buildbut Im not 100% sure
chr.yxOP
ill try
American Fuzzy Lop
you might need to configure something else for this to work
@chr.yx ill try
American Fuzzy Lop
did it work?
chr.yxOP
nope
cause backend doesn't have a project init
American Fuzzy Lop
ya I think you need a package.json in both backend and frontend as well
but you can still do this structure to npm build them in parallel. Ive def seen it
chr.yxOP
oh ok
lemme search how to do
@chr.yx lemme search how to do
American Fuzzy Lop
ya sorry I havent personally worked w it.
chr.yxOP
np
thanks for ur time!
@chr.yx Click to see attachment
whats that?
is this some kind of express api in your backend
or something similar
chr.yxOP
yes
express
ok, and u made sure u can run your api with nodemon or whatever
chr.yxOP
yep
@chr.yx yep
and your fronted is a nextjs app?
chr.yxOP
ye
and you are directly deploying that to vercel using the nextjs config?
from vercel
chr.yxOP
through github repo
does it have a logo like this on top left
chr.yxOP
no
yeah thats not a good practice, u should deploy your next and api separately
u can keep both in the same project structure and use vercel cli
chr.yxOP
oh
is there docs on how to do that?
there are docs and im pretty sure there is a way for that
https://vercel.com/docs/cli/deploying-from-cli
https://vercel.com/docs/cli/deploying-from-cli
u should ask here
if u really dont want to do that take a look at this
chr.yxOP
ok thanks
with that u can run two commands in the same npm script
@chr.yx is there docs on how to do that?
American Fuzzy Lop
if you need help doing it in this format I have done it like this on vercel