How to get proper node_modules under `.next/` when using monorepo?
Unanswered
Golden northern bumble bee posted this in #help-forum
Golden northern bumble beeOP
My next project is in monorepo. When I build it, I don't get node_modules under
.next directory. How to get the list of modules to install them afterwards?49 Replies
@Golden northern bumble bee My next project is in monorepo. When I build it, I don't get node_modules under `.next` directory. How to get the list of modules to install them afterwards?
.next doesn’t have node_modules inside it, monorepo or not
Golden northern bumble beeOP
.next/standalone/node_modules - this oneI expected to get proper
package.json in .next/standalone but it doesn't have any dependencies listedStandalone mode then idk sorry
Golden northern bumble beeOP
😦
Meh, there should be a way, or it stops making any sense
Ah, that's in the docs actually.
Missed it before
Golden northern bumble beeOP
meh, it didn't help
Golden northern bumble beeOP
@joulev It seems I'll have to give up on standalone builds. 😕
I cannot find in the docs the precise procedure on how to deploy "normal" builds
But I do need node_modules, do I?
And I will need to copy them to the production then, right?
@Golden northern bumble bee I cannot find in the docs the precise procedure on how to deploy "normal" builds
What do you mean by "normal" builds?
Golden northern bumble beeOP
Well, just regular way to deploy a nextjs app
what's inside .next, right?
Normally you would just do
npm buildThen use
npm start toGolden northern bumble beeOP
Ok, and how to get all this on the server?
How to transfer it say in a docker image
The docs have all the info for that
Golden northern bumble beeOP
It doesn't say that
I read it
You need some way to transfer the files to your server?
I dont know exactly the best way but normally you would use ftp to transfer the files to your server and then use npm start or well if you are using docker, follow the steps in that guide for docker.
You are basically running a server inside a server
Setting up a CI pipeline for this is recommended
Golden northern bumble beeOP
@Clown My question is not about actually copying files, rather - what files I need
so you say that I need just the same project directory
so I need to get
node_modules thereand its size can be a gigabyte easily
300Kb webstie with 1Gb of node_modules, that's insane
and I have to transfer all this to the server every deploy?
Why would you transfer the node modules folder ?
Golden northern bumble beeOP
how would next work without them?
oh, you mean running npm i
Yes
Golden northern bumble beeOP
Idk, if it's ok if server would need to install that
including modules from private company registeries
But why not, I could provide that I think
I dont think it would be an issue
You can just use standalone otherwise in which case you only need that one folder
You do NOT need node_modules in standalone.
Also yes, you need to either upload the new standalone each time or create a CI pipeline that will do it for you
Also yes, you need to either upload the new standalone each time or create a CI pipeline that will do it for you
@Clown You can just use standalone otherwise in which case you only need that one folder
Golden northern bumble beeOP
No, standalone doesn't work - hence this thread. I started with stadnalone.
And it should have its own
node_modules dir, but not in my case: in monorepo it's just not there 😦I tried to engage techniques listed in the Caveats section, but they didn't work
Hmm i guess i dont know then.