Azure Functions - 导入自定义节点模块
Azure Functions - Import Custom Node Module
我正在试验 Azure Functions。我正在尝试在我的函数中使用第三方节点模块。但是,我一直无法弄清楚如何导入它。
{
"id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"requestId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"statusCode": 500,
"errorCode": 0,
"messsage": "Exception while executing function: Functions.analyze -> Error: Cannot find module 'moment'\n at Function.Module._resolveFilename .."
}
我只是想导入 moment.js 节点库。不过,我找不到有关此场景的任何文档。
有人知道如何将第三方模块导入 Azure Functions 吗?
- 在 Azure portal 中的函数应用程序中,单击 平台功能 和 高级工具 (Kudu)。
cd
通过 调试控制台 (CMD 或 PowerShell)和 运行 命令进入您的函数目录:npm install moment
.
这已经过时了。相反,转到高级工具 (Kudo) -> Bash -> cd site/wwwroot -> npm i package
我正在试验 Azure Functions。我正在尝试在我的函数中使用第三方节点模块。但是,我一直无法弄清楚如何导入它。
{
"id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"requestId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"statusCode": 500,
"errorCode": 0,
"messsage": "Exception while executing function: Functions.analyze -> Error: Cannot find module 'moment'\n at Function.Module._resolveFilename .."
}
我只是想导入 moment.js 节点库。不过,我找不到有关此场景的任何文档。
有人知道如何将第三方模块导入 Azure Functions 吗?
- 在 Azure portal 中的函数应用程序中,单击 平台功能 和 高级工具 (Kudu)。
cd
通过 调试控制台 (CMD 或 PowerShell)和 运行 命令进入您的函数目录:npm install moment
.
这已经过时了。相反,转到高级工具 (Kudo) -> Bash -> cd site/wwwroot -> npm i package