0

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

4
  • are you deploying to azure webapp (azure sites) Commented Nov 17, 2015 at 13:37
  • Yes @Sgrm, I am. I went to the gallery and chose "NodeJS Empty Web App" under Azure Webapp. Commented Nov 18, 2015 at 14:01
  • well since you already got the answer all is well. anyway if it was correct you should mark it up as such Commented Nov 18, 2015 at 14:36
  • Well, there's Joe's solution and then there's Gary's. Both work, so I had asked a question yesterday about safety on Joe's answer. I was waiting for him to reply before I chose the safest one for my case. He had not replied by the time I went to sleep. Please see his answer below. Commented Nov 19, 2015 at 9:09

2 Answers 2

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:

enter image description here

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.: enter image description here

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a million. I had already configured it to use Github and had a package.json from my local repository that had the package included. However, I didn't know it would actually install the packages in the package.json. Thanks for your time.
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

enter image description here

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

2 Comments

That was relatively easy and painfree. Thanks for your time. I'm guessing KUDU is a Microsoft (or trusted by) tool that I can recommend to my boss. Is that so?
Yes, you can absolutely recommend it. Also, being this worked for you can you make sure to select my response as the answer? Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.