使用补丁包模块的 Azure App Service 节点部署

Azure App Service node deployment with patch-package module

我正在尝试 运行 在 Azure App Services 上部署 Node 应用程序期间(通过 BitBucket 的持续集成进行部署)进行补丁包。补丁包脚本在本地(Mac)运行良好,但在 Azure(Windows)上运行失败。补丁包模块安装在 node_modules 但 post-install 脚本失败并出现以下错误:

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

这是我的(简化版)package.json 文件:

{
  "name": "my-app",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "private": true,
  "dependencies": {
    ...
    "patch-package": "^6.4.4",
    ...
  },
  "scripts": {
    "postinstall": "patch-package"
  }
}

当我尝试在 Kudu 命令行中手动 运行 npm i 时出现相同的错误。

万一其他人遇到这个问题,以下是为我解决的方法:

- 停止了网络应用程序 -删除了 node_modules 文件夹 -运行 来自 git 仓库的新部署(重新安装了所有模块)

一切恢复正常。