codetheweb / anylist

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

Example code does not run #3

Closed NEMadman closed 4 years ago

NEMadman commented 4 years ago

I'm a Nodejs novice and had issues getting anylist to be installed on a Fedora 31 system (nodejs-12.16.1-1.fc31.x86_64) so I went to my old RHEL 6.4 system and installed it there which had nodejs-0.10.48-3.el6.x86_64 installed. While the install was successful I could not run the example code I got this error:

serv%~/src/anylist > node testanylist.js

~/src/anylist/testanylist.js:5
any.on('lists-update', lists => {
                              ^
const AnyList = require('anylist');
SyntaxError: Unexpected token >
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:945:3

My understanding of the issue is a syntax is being used that is not supported by the version of Nodejs installed. Assuming the version of Nodejs was indeed good enough to install anylist on then I suggest the example code / README.md be updated to include the minimum required version to run the example. Otherwise the minimum version for anylist should be updated. If nothing else what version of Nodejs are you using that anylist can be installed with and the example will run?

codetheweb commented 4 years ago

Node 0.10 is quite old. I don't know the exact minimum version that would work with this, but anything ≥ 12.0.0 will definitely work.

I'll add a note to the README.