Guest Post by Guy Barrette
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:
Navigate to that URL, this will launch Kudu.
Select the Debug Console tab and the CMD option.
Using the UI or the command prompt, navigate to “site\wwwroot\App_Data\config\scripts”
Edit the package.json file by clicking on the pen icon
Change the version of the package that you want to downgrade.
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.
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.
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.