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.64k stars 339 forks source link

[fix] Syntax error when imported #441

Closed crs26 closed 1 year ago

crs26 commented 1 year ago

Describe the bug

Node.js version: v12.22.9

OS version: Ubuntu 22.04.1 LTS

Description: Code was running smoothly on windows and ubuntu server with lower version. But when tested on Desktop Ubuntu there's always an error of SyntaxError: Unexpected token '?' when the library is imported.

Actual behavior

Throws an error SyntaxError: Unexpected token '?' when the library is imported

Expected behavior

It should not throw an error when imported

Code to reproduce

import Email from 'email-templates'

export default async function handler (req, res) {
  res.send('ok')
}

Checklist

titanism commented 1 year ago

We would need to see the full stack trace. This does not appear to be a problem with our library.

OnnoGabriel commented 1 year ago

I had the same error. It is fixed by using a newer Node.js version (18.12.1 in my case).