【发布时间】:2021-06-09 10:37:15
【问题描述】:
我正在使用本地 git 部署 azure 功能。
我在本地运行 npm install @azure/cosmos 并安装了 @azure/cosmos。
我将代码推送到 Azure。
当我执行该函数时,错误消息显示“找不到模块'@azure/cosmos'”。
为什么?
我的功能码是:
const { CosmosClient } = require("@azure/cosmos")
module.exports = async function (context) {};
以下代码不会引发错误:
const { v4: uuid } = require('uuid')
module.exports = async function (context) {};
我的 package.json 是:
{
"name": "name",
"version": "1.0.0",
"description": "",
"scripts": {
"start": "func start",
"test": "echo \"No tests yet...\""
},
"dependencies": {
"@azure/cosmos": "^3.11.3",
"azure-storage": "^2.10.4",
"uuid": "^8.3.2"
},
"devDependencies": {}
}
【问题讨论】:
-
请添加一些Azure函数代码,函数是用JS写的&使用
azure/cosmos包吗? -
this tutorial能帮到你吗?
-
@TinyWang 我读过但无法修复错误。
标签: azure azure-functions azure-app-service-plans