Azure Mobile Services with Node


Guest Post by Guy Barrette


clip_image001

Here’s an interesting scenario: you’re using Azure Mobile Services with a Node backend and you use version 1.0 of Package A. You then install Package B that has a dependency on a newer version of Package A. Package A is now updated to version 2.0 but your code doesn’t work anymore. You decide that you won’t use Package B anymore but you’re stuck with Package A version 2.0, an incompatible version and changing Package A version in package.json doesn’t work. Package hell! (in memory of the good old COM days!)

If you’re stuck with an incompatible package and want to downgrade you may want to use the Kudu debug console to force some changes directly from the browser by following these steps:

Get your Mobile Services URL and insert SCM after the service name like this:
https://[theservicename].scm.azure-mobile.net

Navigate to that URL, this will launch Kudu.

clip_image003

Select the Debug Console tab and the CMD option.

clip_image004

Using the UI or the command prompt, navigate to “site\wwwroot\App_Data\config\scripts”

clip_image005

Edit the package.json file by clicking on the pen icon

clip_image006

Change the version of the package that you want to downgrade.

clip_image007

Next, navigate to “site\wwwroot\App_Data\config\scripts\node_modules”. You should see the node modules that you have installed. Try deleting the package folder using the Delete button or by using the command prompt.

clip_image008

Note that you may have to restart your mobile service for the delete to work. You can do that by clicking on the Restart button in the portal.

clip_image009

Warning: do you have a backup or a local version?  Why not use the Download button before deleting the folder? 😉

Restarting your mobile service will trigger an automatic download of the dependencies and solve the issue.

Comments (1)

  1. great tip! says:

    Great tip, I've added this page to Awesome-AzureMobileServices – a catalog of useful resources for peeps working with Azure Mobile Services

    github.com/…/README.md

Skip to main content