Run NodeJS command on Azure

牧云@^-^@ 提交于 2019-12-13 05:18:35

问题


I am fairly new to NodeJS development. I have no issues whatsoever running commands on my local machine. For instance, say I want to install a package called "formidable" on my Node server, I'd run the command 'npm install formidable'. If I have deployed my NodeJS application to Azure, how would I run the same command?

NB - I do not want to manually run the command on my local machine and then deploy to Azure. This will take far too long, since I have to install many packages each with many files in them.

Please advise on how I go about doing this?

Thanks


回答1:


If you are running an Azure Web App you can use Kudu Services.

To do this

  • browse to http://yoursitename.scm.azurewebsites.net
  • It will ask you to authenticate if you have not already
  • Click on Debug Console -> CMD

You can run your npm commands from there.

Screen shot below

More information can be found here: https://github.com/projectkudu/kudu/wiki




回答2:


Beside login KUDU console site and run command in online cmdlet. You also can configure dependencies in package.json, then you deploy your nodejs application to Azure via GIT, it will automatically install the dependencies in this file.

For example:

You add the formidable module in dependencies:

Then deploy it application on Azure Web Apps, you can see the remoting deployment logs in cmdlet that the module was added in the application on Azure, e.g.:

You can refer to Create a Node.js web app in Azure App Service for how to create a nodejs application and deploy via GIT.



来源:https://stackoverflow.com/questions/33758298/run-nodejs-command-on-azure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!