Reputation: 2043
I'm creating a build in Azure pipelines and copying node_modules as well as 'out' folder, package.json, package-lock.json, next.config.js and .next folder. I copy all of these into an artifact directory. I then zip this as an artifact and then do a zip deploy to Azure App Service Linux Web app.
However running npm start (which just points to next start in the package.json) doesn't work as it complains about next not being found in node_modules (even though its there)
What do I need to do to get it work?
If I download the zip file and unzip it locally, it doesn't work either even though all the node_modules are there. I need to run npm ci to be able to get next start to work. How come?
Aren't I meant to just be able to copy node_modules across and everything should just work?
Also bonus points - do I need to force next to start on port 8080 on azure? The default port 3000 doesn't seem to work? And Azure docs say that npm install is run when package.json is detected. However that's clearly not happening either.
Any help and insights would be most appreciated!
Upvotes: 1
Views: 995
Reputation: 2043
If anyone is trying to deploy Next.js SSR apps to Azure Web apps, the issue is the copying of the node_modules and the config of next.config.js
Upvotes: 0