Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm install emailjs worked but all attempts at require fail #112

Closed
tombates opened this issue Nov 21, 2014 · 5 comments
Closed

npm install emailjs worked but all attempts at require fail #112

tombates opened this issue Nov 21, 2014 · 5 comments

Comments

@tombates
Copy link

I'm fairly new to node et. al. and I've installed several packages and used them happily but I am having a real issue with getting emailjs to even get loaded. After the "install npm emailjs", which worked without errors, I do indeed see the whole emailjs tree inside node_modules off the root of my project just like any other package install.

I have tried many variations now on the require statement in the router where I want to use emailjs but they all fail at npm start time with error statements about a failure to find required middleware the details of which according to exactly what require I try. Apparently I do not understand what require("./path/to/emailjs/email") should become in my case even. I realize you don't have all my code here but I'd thought I'd first see if there's just something simple I'm just missing regarding the darn require statement:

For emailjs none of the following have worked:

//var email = require('emailjs/email');
//var email = require('node_modules/emailjs/email');
//var email = require('./node_modules/emailjs/email');
//var email = require('./emailjs/email');
//var email = require('email');
//var email = require('emailjs');

Apparently I do not understand what require("./path/to/emailjs/email") should become in my case even though I don't have to do anything for any other package other than require('packagename') to get it to go. I realize you don't have all my code here but I'd thought I'd first see if there's just something simple I'm just missing regarding the darn require statement:

I apologize if this is not appropriate as an issue here but I've found no help from google and I'm about to give up on emailjs and I really don't want to. Thanks.

@tombates
Copy link
Author

OK, I've finally found my error. All my fault. var email = require('emailjs'); works fine once I saw I'd left out a module.exports line... Ugh.

@pushkarmoi
Copy link

Hi i am having the same issue. What moule.exports line? and where??

@eleith
Copy link
Owner

eleith commented May 29, 2016

after npm install emailjs you just need to require('emailjs')

@kyabroudi
Copy link

same issue here !!

@eleith
Copy link
Owner

eleith commented Feb 9, 2018

if you use npm to install emailjs all you need to do is const emailjs = require('emailjs') if you install from github, you'll need to run npm install in the emailjs directory before you can use this library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants