本文介绍了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
.
这篇关于Azure Functions - 导入自定义节点模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!