I am trying to run patch-package during a Node app deployment on Azure App Services (deployed with continuous integration from BitBucket). The patch-package script works fine locally (on Mac), but fails on Azure (Windows). The patch-package module is installed in node_modules but the post-install script fails with the following error:
Command: "D:\home\site\deployments\tools\deploy.cmd" Handling node.js deployment. Creating app_offline.htm KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot' Deleting app_offline.htm Looking for app.js/server.js under site root. Using start-up script app.js Generated web.config. The package.json file does not specify node.js engine version constraints. The node.js application will run with the default node.js version 14.16.0. Selected npm version 6.14.11
my-app@1.0.0 postinstall D:\home\site\wwwroot patch-package
'patch-package' is not recognized as an internal or external command, operable program or batch file. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! rs-email-yelp@1.0.0 postinstall:
patch-package
npm ERR! Exit status 1
And here is my (simplified) package.json file:
{
"name": "my-app",
"version": "1.0.0",
"description": "",
"main": "app.js",
"private": true,
"dependencies": {
...
"patch-package": "^6.4.4",
...
},
"scripts": {
"postinstall": "patch-package"
}
}
I get the same error when I try and manually run npm i
in Kudu command line.
In case anyone else has this issue, here is what solved it for me:
-stopped the web app -deleted the node_modules folder -ran a new deploy from git repo (which reinstalled all modules)
Everything back to normal.