从AWS Lambda发送SES电子邮件-节点JS错误“找不到模块'nodemailer'"; [英] Sending SES email from AWS Lambda - Node JS Error "Cannot find module 'nodemailer"
本文介绍了从AWS Lambda发送SES电子邮件-节点JS错误“找不到模块'nodemailer'";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到以下错误消息:"errorMessage":找不到模块'nodemailer'"
I have this error message: "errorMessage": "Cannot find module 'nodemailer'"
我用Google搜索,并说安装nodemailer.有人可以告诉我该模块的确切安装位置吗?我是Lambda的新手.
I Googled, and it says install nodemailer. Can someone tell me where exactly do I install this module? I am new to Lambda.
我的Lambda函数如下:
My Lambda function is below :
var aws = require("aws-sdk");
var nodemailer = require("nodemailer");
var ses = new aws.SES();
var s3 = new aws.S3();
exports.handler = (event, context, callback) => {
callback(null, 'Hello from Lambda');
};
推荐答案
- 您必须在本地初始化项目
npm init
- 安装 nodemailer -
npm i nodemailer
- 您应该压缩项目目录,然后在功能代码窗口中选择上传.ZIP文件,将其上传到lambda.
- 现在您可以选择进行测试了.
- 只需将所有代码放入
index.js
中进行初始测试,以后就可以随意移动.
- You'll have to initialize your project locally
npm init
- Install nodemailer -
npm i nodemailer
- You should zip your project directory, upload it to lambda by selecting Upload a .ZIP file in the function code window.
- Now you'll get an option to test.
- Just put all the code in
index.js
for your initial tests, later you can move it around.
这篇关于从AWS Lambda发送SES电子邮件-节点JS错误“找不到模块'nodemailer'";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文