Next.js Discord

Discord Forum

Deploying node_modules to IIS

timvd7652 posted this in #help-forum
Open in Discord
I've succesfully deployed my Nextjs application on an IIS application (so root/subapplication). I do have some issues however. The way I currently deploy the application is by running next build and copying the build output (the .next folder) to the build folder that the IIS application looks at. Currently I also copy the nodemodules and a custom web.config and server.js to the build folder. An iisnode folder is then later added by IISNode. So the folder looks like this:
.next|_ nodemodules| web.config| server.js| iisnode**The problem:** When I add CI/CD into the mix, running a pipeline on our Azure Devops server, building an artifact and placing the artifact in build folder, the node_modules don't get updated. I know thatNextjshas astandaloneoutput that includes thenode_modulesin the build but that version doesn't work as it can't find the node_module (issue has been addressed on the Vercel forums). Surely there must be another way to add the node_modules automatically. I've been thinking about adding the possibility of adding a script to the staging area that run a yarn install when done. I don't know if this is possible as I've very little experience with Azure Devops. This would then require me to add thepackage.json` instead.

Does anyone have any experience with this? I'd love to hear some ideas or suggestions.

1 Reply

This is the error I get when I publish without node_modules, but with using yarn install in my pipeline: