I’d like to move to npm. When I try to use the npm mailchim packge https://www.npmjs.com/package/mailchimp-api-3 I got the following error:
I20170908-10:57:38.566(2)? Exception while invoking method 'registerNewsletter' SyntaxError: Unexpected token {
I20170908-10:57:38.568(2)? at exports.runInThisContext (vm.js:53:16)
I20170908-10:57:38.570(2)? at Module._compile (module.js:373:25)
I20170908-10:57:38.571(2)? at Object.Module._extensions..js (module.js:416:10)
I20170908-10:57:38.572(2)? at Module.load (module.js:343:32)
I20170908-10:57:38.574(2)? at Function.Module._load (module.js:300:12)
I20170908-10:57:38.576(2)? at Module.require (module.js:353:17)
I20170908-10:57:38.578(2)? at require (internal/module.js:12:17)
I20170908-10:57:38.587(2)? at Object.<anonymous> (C:\Projects\...\code\node_modules\mailchimp-api-3\ind
ex.js:1:18)
I20170908-10:57:38.588(2)? at Module._compile (module.js:409:26)
I20170908-10:57:38.589(2)? at Object.Module._extensions..js (module.js:416:10)
The code I used was:
let Mailchimp = require('mailchimp-api-3');
let mailchimp = new Mailchimp("...");
mailchimp.members.create("...", {
email_address: email,
merge_fields: {},
status: 'subscribed',
}).then(user => {
console.log(user);
}).catch(e => {
console.log(e);
});
The atmosphere package works fine.