本文介绍了Azure功能-导入自定义节点模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用Azure Functions.我正在尝试在我的函数中使用第三方Node模块.但是,我一直无法弄清楚如何导入它.
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'\n at Function.Module._resolveFilename .."
}
我只是想导入moment.js节点库.不过,我找不到有关这种情况的任何文档.
I'm just trying to import the moment.js Node library. I was unable to find any documentation around this scenario though.
有人知道如何将第三方模块导入Azure Functions吗?
Does anyone know how to import a third-party module into Azure Functions?
推荐答案
- 在功能应用程序的 Azure门户网站中,依次点击平台功能和高级工具(Kudu).
- In your function app in the Azure portal, click Platform features and Advanced tools (Kudu).
- 通过调试控制台(CMD或PowerShell)
-
cd
进入功能目录,并运行命令:npm install moment
.
cd
into your function directory via Debug console (CMD or PowerShell) and run the command:npm install moment
.
这篇关于Azure功能-导入自定义节点模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!