Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find module 'nodemailer'

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:

var nodemailer = require ('nodemailer');
like image 461
Fábio Junio Alves Sousa Avatar asked May 15 '17 14:05

Fábio Junio Alves Sousa


Video Answer


2 Answers

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.

like image 51
ThisClark Avatar answered Sep 22 '22 12:09

ThisClark


First ensure you call npm install nodemailer --save at project root.

Then replace

Var nodemailer = require ('nodemailer');

with

var nodemailer = require('nodemailer');

like image 38
Stephane Janicaud Avatar answered Sep 19 '22 12:09

Stephane Janicaud