azure 应用程序服务('bf' 未被识别为内部或外部命令)

azure app service ('bf' is not recognized as an internal or external command)

我在我的 nodejs 项目中使用 ["@microsoft/botframework-cli": "^4.14.1"] 库时遇到问题。下面是我的项目示例片段。我只是在 node-cmd 库的帮助下执行了几个 bf 命令。

const http = require('http');
const shell = require('node-cmd');
const server = http.createServer(async (req, res) => {
  cmd = `bf orchestrator:basemodel:get --out ./model`
  await shell.runSync(cmd);
  res.writeHead(200, {"Content-Type": "text/plain"});
  res.end("Process completed");
});
const port = process.env.PORT || 1337;
server.listen(port);
console.log('SERVER RUNNING AT',port);

以上代码在我本地运行良好。但是当我将相同的代码部署到 azure web 应用程序时,我得到

'bf' is not recognized as an internal or external command

我导航到 KUDU 编辑器并检查 botframework node_modules 是否安装正确。虽然库已正确安装。我什至尝试过使用 Azure 函数。但它仍然是一样的。 请帮我解决这个问题。

npm install 中读取 package.json 以创建依赖项列表并使用 package-lock.json 通知要安装这些依赖项的版本。 如果依赖项不在 package-lock.json 中,它将由 npm install.

添加

npm ci(以 Continuous Integration 命名)直接从 package-lock.json 安装依赖项并使用 package.json 只是为了验证没有不匹配的版本。 如果缺少任何依赖项或具有不兼容的版本,它将抛出错误。检查 here

而不是使用 npm install 您可以使用 npm ci

"scripts": {
    "install": "npm ci",
}

"scripts": {
    "install": "npm ci @microsoft/botframework-cli",
}

参考