codetheweb / anylist

📋 a wrapper for AnyList's API (unoffical, reverse engineered)
81 stars 20 forks source link

No stdout for node v18 #25

Closed mikeboiko closed 1 year ago

mikeboiko commented 1 year ago

Hi, I tried to run the following code but nothing happened nor did I get any stdout/stderr:

const AnyList = require('anylist');

const any = new AnyList({email: '<email>', password: '<pw>'});

any.on('lists-update', lists => {
  console.log('Lists were updated!');
});

any.login().then(async () => {
  await any.getLists();

  // Add new item to the Walmart list
  const walmart = any.getListByName('Task');
  let chips = any.createItem({name: 'Chips'});
  chips = await walmart.addItem(chips)
  await chips.save();

  any.teardown();
});

I installed the anylist package and ran this in my terminal on Linux:

╭─mike@asus ~/temp/anylist  ‹master*›
╰─➤  node --version
v18.9.1
╭─mike@asus ~/temp/anylist  ‹master*›
╰─➤  node script.js

Could you please let me know if I need to do anything differently?

codetheweb commented 1 year ago

Try adding some logging to see what's getting returned / if login is working.

mikeboiko commented 1 year ago

Hi, for some reason my reply a week ago didn't save, so let me post it again. I added the following logging:

any.login().then(async () => {
  await any.getLists();

  // Add new item to the Walmart list
  const walmart = any.getListByName('Task');
  console.log(walmart);
  let chips = any.createItem({name: 'Chips'});
  console.log(chips);
  chips = await walmart.addItem(chips)
  console.log(chips);
  await chips.save();

  any.teardown();
});

I'm still not seeing any stdout when I run node script.js I'm not super familiar with node though. Should I be logging in a different way/place?

Thanks!

codetheweb commented 1 year ago

You should be seeing something with that--not sure what else could be the issue, sorry.

mikeboiko commented 1 year ago

Ok thanks for confirming. Which version of node are you using?

mikeboiko commented 1 year ago

I just downgraded node to v12.22.12 and everything worked great! Feel free to close this issue and make a fix for node 18 later.