Azure Functions - 导入自定义节点模块
我正在试验 Azure Functions.我正在尝试在我的函数中使用第三方节点模块.但是,我一直无法弄清楚如何导入它.
<代码>{id":aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",requestId":aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",状态代码":500,错误代码":0,"messsage": "执行函数时出现异常:Functions.analyze -> 错误:在 Function.Module._resolveFilename 处找不到模块 'moment' .."}
我只是想导入 moment.js 节点库.不过,我无法找到有关此场景的任何文档.
有人知道如何将第三方模块导入 Azure Functions 吗?
解决方案- 在
cd
通过调试控制台(CMD 或 PowerShell)进入你的函数目录并运行命令:npm install moment
.
I'm experimenting with Azure Functions. I'm trying to use a third-party Node module in my function. However, I've been unable to figure out how to import it.
{ "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' at Function.Module._resolveFilename .." }
I'm just trying to import the moment.js Node library. I was unable to find any documentation around this scenario though.
Does anyone know how to import a third-party module into Azure Functions?
解决方案- In your function app in the Azure portal, click Platform features and Advanced tools (Kudu).
cd
into your function directory via Debug console (CMD or PowerShell) and run the command:npm install moment
.
相关文章