Cannot find module 'nodemailer'

Fábio Junio Alves Sousa picture Fábio Junio Alves Sousa · May 15, 2017 · Viewed 15.5k times · Source

I'm using the Zapier Code application, I need to send an email receiving trello parameters, I'm using a javascript encoding along with node.js, but when I try to find the nodemailer module I always get the error that it can not be found.

The error always points to this line of code:

Answer

ThisClark picture ThisClark · May 15, 2017

It sounds like you have not installed nodemailer from npm. Navigate to your project folder through a command line terminal and install nodemailer with the below command. If you have a package.json file (and you probably should), you can use the --save flag to record the version you install with your app.

npm install nodemailer --save

Note that nodemailer requires Node.js version 6+ to work correctly. Check your Node.js version with node --version on Windows or OSX and nodejs --version on linux.

Since you're asking this question, you will probably benefit from reading about npm here: https://www.npmjs.com/get-npm

Your package.json file should have the following dependency. You may have to adjust version number to match Zapier requirements.

{
  "dependencies": {
    "nodemailer": "^4.0.1"
  }
}

Upon browsing the Zapier website, it looks like they offer tech support even for free customers. You may consider contacting them directly if this does not resolve your issue.