I am facing a confusing issue while trying to run npm commands programmatically in a React project deployed to Azure App Service.
What works: Running npm commands locally via my Node.js script works perfectly. After deployment, if I log into Azure App Service using PowerShell and run the npm commands manually in the project folder, everything works fine.
What doesn’t work: When I try to run npm commands programmatically on Azure App Service, I get errors indicating an old Node.js version is being used. The error log shows something like:
node -v v0.6.20
npm -v 1.1.37
Error: 11544:error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
What I’ve checked: Node.js version on App Service is updated to a modern version (v22.x). Manual commands in PowerShell on the App Service project folder work fine, using the correct Node version. I also have tried to give node latest version path forcefully.
Goal: I want to run npm commands programmatically as part of an automated end-to-end deployment process on Azure App Service.
If anyone has encountered a similar issue, I would greatly appreciate any guidance or solutions