question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot find module 'underscore'

See original GitHub issue

Seems that upon installing email-templates and pug, by importing email-templates I get the following error:

image

The code I’m using is quite simple:

const Email = require("email-templates");

const email = new Email({
    message: { from: fromAddr },
    send: true,
    transport: __transport
});
email
    .send({
        template,
        message: { to: toAddr },
        locals: Object.assign({
            emailID
        }, properties)
    });

__transport is a Nodemailer transport instance:

__transport = nodemailer.createTransport({
    SES: getSES()
});

I’m running this on Node 10 in a docker container. Everything installs fine, but I get that error when I try to run that code. I’m using Nodemailer v4.6.8 and email-templates v5.0.0.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
niftylettucecommented, Sep 20, 2018

Reinstall node_modules and/or reinstall node. This does not seem to be related to this package since this package does not use underscore directly.

1reaction
perry-mitchellcommented, Sep 20, 2018

Well thanks for the overwhelming support. I’ll find another library.

Read more comments on GitHub >

github_iconTop Results From Across the Web

jshint Error: Cannot find module 'underscore' - Stack Overflow
When you have cannot find module x errors, one thing that might help sometimes is deleting the whole npm_modules folder and just running...
Read more >
Cannot find module 'underscore'. · Issue #4636 - GitHub
I am trying to include Underscore "underscore": "^1.8.3" and I get this error Cannot find module 'underscore'. This is how I try to...
Read more >
Cannot find module 'underscore.js' - Google Groups
Hi, I'm having trouble setting the Cloud Code. Getting a "invalid function" error message. The log is saying that "underscore" is not loaded:...
Read more >
underscore - npm
Underscore.js is a utility-belt library for JavaScript that provides support for the usual functional suspects (each, map, reduce, filter.
Read more >
Cannot find module 'underscore' from inside npm dependency
I get this error when building a Meteor 1.4.2 app with a custom Meteor package, which depends on the npm module html-to-text :...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found