git push node js fails on Azure linux and kudu wants to run dotnet commands
Pushing from local git to Azure App Service git failed.
Until yesterday, it worked well. I really don’t understand why apps running under Linux involve
dotnet in the push execution in Azure. I ran git locally from Windows Powershell and deployed to linux, git add and git commit worked fine but push failed. I’ve searched for similar issues, but this is a bit different from the others I’ve found here.
The error is from git push: PS xxx_deploy> git push Enumerating objects: 3, done. Counting objects: 100% (3/3), done. Delta compression using up to 8 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (2/2), 212 bytes | 212.00 KiB/s, done. Total 2 (delta 1), reused 0 (delta 0) remote: Could not execute because the specified command or file was not found. remote: Possible reasons for this include: remote: * You misspelled a built-in dotnet command. remote: * You intended to execute a .NET Core program, but dotnet-/opt/Kudu/KuduConsole/kudu does not exist. remote: * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH. To https://xxxx.scm.azurewebsites.net/xxxx.git
The files being deployed are
The dotnet it’s looking for isn’t in that folder, I’ve checked, but why does a Node js deployment need it?
I tried some suggestions via a google search, including:
- Enter and line feed flags, ‘git config –global core.autocrlf true’, I’ve
tried both true and false
- I deleted the files in /home/site/deployments/tools/ for my Azure application because someone suggested that the deployment files might be corrupted, but it didn’t help.
I’d appreciate some solutions to this because I can no longer push new changes to the app.
The problem has been resolved
After trying some solutions, the problem was finally solved.
My hypothesis is that the problem stems from Azure App Service’s change to the platform version. I can confirm this because I’ve saved a copy of the app settings from a week ago. The previous version was PLATFORM_VERSION 22.214.171.124 and the new version was PLATFORM_VERSION 126.96.36.1994 for applications that I don’t know anyone else. This also led to some changes in environment variables. For example, PATH is missing /opt/dotnet/2.2:/root/.dotnet/tools, the CLR version has changed, and so has NODE_VERSION.
This seems to result in a mismatch between the deployed file and the newly pushed file. Most likely Kudu-git stores some metadata for the platform in its list, so it can’t build a new push.
For anyone experiencing this issue in the future:
To resolve conflicts, create a newui in your Kudu deployment URL, such as
Open a bash terminal from this page and use rm to delete everything in the home directory, or open a file manager and delete all files/folders in the home directory.
Perform a new git commit and push, and your application will deploy correctly. This seems to clear all your previous deployments. For deploying repos, if it’s a source repo, it would be a disaster.