10

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');

1
  • Did you try something like this? If you need more control on the data, you can put some Javascript in between.
    – webwurst
    May 21, 2017 at 0:29

5 Answers 5

21

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.

5
  • Hello friend thank you very much for your attention I am using the Zapier Code application and in the documentation it informs that it supports Node 4.3.2, do you think I can accomplish my action with these features? May 15, 2017 at 14:52
  • Are you able to determine the version of Nodemailer that you are using? Is there a record of the version anywhere in your application? I know the Nodemailer website says Nodemailer version 4+ requires Node.js version 6+ nodemailer.com/about
    – ThisClark
    May 15, 2017 at 14:58
  • I can tell the version of node.js that is supported through the application documentation that is available at this link: zapier.com/help/code (By searching for "node" on the page, the first result already shows the version). Does this help in any way? May 15, 2017 at 15:04
  • Everywhere I look in the Nodemailer documentation says Node.js 6+ is wanted for version 3 and up. Version 2 of nodemailer is no longer supported. You could try setting the package.json dependency to version 2 and see if you have any success.
    – ThisClark
    May 15, 2017 at 15:10
  • You are helping me after 3 hours of searching. Thanks. Apr 13, 2022 at 11:32
1

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

Then replace

Var nodemailer = require ('nodemailer');

with

var nodemailer = require('nodemailer');

1

You can't import npm modules in "Zaps": Requiring or Using External Libraries

0

Use this :

npm install nodemailer

And your var nodemailer = require ('nodemailer') will work.


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

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

2
  • yarn add nodemailer. Also you forgot 'er' at the end of nodemail
    – coyotte508
    May 15, 2017 at 14:46
  • Thanks for the reply, my friend. I've added this line of code, but now the Zapier Code application tells me: SyntaxError: Unexpected identifier May 15, 2017 at 14:50
0

Make sure you have a dependency in package.json inside functions Make sure you have a dependency in package.json inside functions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.