forwardemail / email-templates

Create, preview (browser/iOS Simulator), and send custom email templates for Node.js. Made for @forwardemail, @ladjs, @cabinjs, @spamscanner, and @breejs.
https://forwardemail.net/docs/send-emails-with-node-js-javascript
MIT License
3.67k stars 337 forks source link

SyntaxError being reported on run #254

Closed mr-White closed 7 years ago

mr-White commented 7 years ago

Node v6.10.1

T:\Projects\TestProject\Repo\node_modules\email-templates\index.js:98
    return new Promise(async (resolve, reject) => {
                             ^
SyntaxError: Unexpected token (
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at require (internal/module.js:20:19)
    at T:\Projects\TestProject\Repo\server\module\email\index.js:28:17
    at Object.<anonymous> (T:\Projects\TestProject\Repo\server\module\email\index.js:172:3)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at require (internal/module.js:20:19)
    at T:\Projects\TestProject\Repo\server\module\api\contact\controller.js:25:15
    at Object.<anonymous> (T:\Projects\TestProject\Repo\server\module\api\contact\controller.js:122:3)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
[nodemon] app crashed - waiting for file changes before starting...

This error is seen on const Email = require('email-templates');

niftylettuce commented 7 years ago

I have to add support for Node 6 and 7. Currently you can only use v3 with Node 8+. I will ping you back once Node 6 is supported. Should be tonight.

On Oct 19, 2017 7:17 PM, "Michael Lage" notifications@github.com wrote:

Node v6.10.1

T:\Projects\TestProject\Repo\node_modules\email-templates\index.js:98 return new Promise(async (resolve, reject) => { ^SyntaxError: Unexpected token ( at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at Module._compile (module.js:542:28) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at require (internal/module.js:20:19) at T:\Projects\LageTech\Repo\server\module\email\index.js:28:17 at Object. (T:\Projects\LageTech\Repo\server\module\email\index.js:172:3) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at require (internal/module.js:20:19) at T:\Projects\LageTech\Repo\server\module\api\contact\controller.js:25:15 at Object. (T:\Projects\LageTech\Repo\server\module\api\contact\controller.js:122:3) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) [nodemon] app crashed - waiting for file changes before starting...

This error is seen on require('email-templates')

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/niftylettuce/email-templates/issues/254, or mute the thread https://github.com/notifications/unsubscribe-auth/AAf7hemtOg0q9AlVQ1XQZvov22BltA0Tks5st9icgaJpZM4P__TI .

mr-White commented 7 years ago

@niftylettuce I have availability to work on this, this weekend (tomorrow).

If there is any way I can help, please let me know.

Unfortunately, I don't know what it takes to make this work on Node 6 & 7, but if you can point me in the right direction (maybe share an upgrade guide from 6 to 8 that I can reverse or something), I could setup a pull request to get this in.

Food for thought! Thank you for your hard open source work! Big fan of this module

niftylettuce commented 7 years ago

@mr-White This package now works on node >=7.6.0 (as of email-templates@3.1.1 via npm install email-templates@latest).

Node 6 and prior really lacked features (e.g. async/await, promises, etc) which are all now being used as a standard in node community. Also see breaking changes documentation at https://github.com/niftylettuce/email-templates#v3-breaking-changes. You should be able to simply upgrade your node version fairly easily.

I recommend using https://github.com/creationix/nvm to manage your node versions (of course if you use this, you should uninstall node completely first).

Feel free to ping here, email, or Slack message if you need help.

niftylettuce commented 7 years ago

@mr-White you can now use this package on node v6.4.0+. npm install email-templates@latest

mr-White commented 6 years ago

And the error is gone.

Thank you @niftylettuce !