0
votes

I am deploying a node webapp via the Azure CLI from my local source folder. I'm trying to understand how to get the node modules to get deployed. I can log into the deployed webapp, see the missing node_modules folder, and install them manually via this process:

browse: https://{app_name}.scm.azurewebsites.net/ > click: Bash > cd site/wwwroot > note there is no node_modules folder, despite there being package-lock.json and package.json! > npm ci > restart webapp

But the question is how to do this automatically from the deploy process. I am using 'az webapp up' from my local source folder to upload the webapp. It has a package-lock.json and a package.json as below:

{
  ...
  "main": "index.js",
  "dependencies": {
    "express": "^4.17.1",
    "socket.io": "~2.3.0"
  },
  "scripts": {
    "start": "node index.js"
  }
}
1
I have a workaround, but would still like an answer as to how to pull the node modules post-deployment. In the meantime, I am able to zip my app (including the node_modules folder) and upload via az webapp deployment source config-zip. It's a good thing, too, because the manual workaround is far from reliable. I've found getting access to the console via ssh or bash works only occasionally - often, it won't connect or will open but won't let you type.siddarfer

1 Answers

0
votes

There are many ways to deploy the web app with node_modules you can choose.

  1. Zip Deploy
  2. FTP Deploy
  3. Drag the project files to wwwroot in kudu
  4. Deploy through Git Action or DevOps
  5. Deploy from VS Code

...( az webapp up is not a broad approach for deployment.)

If you have to use CLI command, you could use Deploy ZIP file with Azure CLI