Cannot find module 'nodemailer'

I am using Zapier Code app, I need to send an email with trello parameters, I am using javascript encoding along with node.js, but when I try to find the nodemailer module, I always get that it cannot be found.

The error always points to this line of code:

Var nodemailer = require ('nodemailer');
      

Run codeHide result


+3


source to share


4 answers


It looks like you haven't installed nodemailer from npm . Go to your project folder via command line terminal and install nodemailer using the following command. If you have a package.json file (and you probably should), you can use a flag --save

to record the version installed with your application.

npm install nodemailer --save

      

Please 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 are asking this question, you might find it helpful to read about npmjs here: https://www.npmjs.com/get-npm



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

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

      

When browsing the Zapier website, it looks like they offer tech support even for free customers. You can contact them directly if this does not solve your problem.

+2


source


First make sure you are calling npm install nodemailer --save

at the root of the project.

Then we replace

Var nodemailer = require ('nodemailer');



from

var nodemailer = require('nodemailer');

+1


source


You cannot import modules npm

into "Zaps": Requiring or using external libraries

+1


source


Use this:

npm install nodemailer

      

And yours var nodemailer = require ('nodemailer')

will work.


https://docs.npmjs.com/getting-started/installing-npm-packages-locally

https://www.npmjs.com/package/nodemailer

0


source







All Articles