totev / vodafone-station-cli

Access your Vodafone Station from the comfort of the command line.
MIT License
35 stars 8 forks source link

SyntaxError: Unexpected token '.' #141

Closed cifrosul closed 1 year ago

cifrosul commented 1 year ago

Hello,

Not sure if it's an issue with the code or my environment, but when I run any of the vodafone-station-cli command I get this error: SyntaxError: Unexpected token '.'

I've installed it via npm and haven't seen any errors at the time of the installation (vodafone-station-cli/1.2.8 linux-arm node-v12.22.12)

It runs on a RPI 3B+, latest raspian release: Linux 6.1.21-v7+ #1642 SMP armv7l GNU/Linux The target is Arris TG3442VF, Firmware: AR01.04.046.17_060822_7244.SIP.10.X1

totev commented 1 year ago

I just ran it on my Pi4 and didn't see it when running the discover command. How did you install/run it?

cifrosul commented 1 year ago

install: sudo npm install vodafone-station-cli run: vodafone-station-cli discover (only help works) / running with sudo - same error.

totev commented 1 year ago

Do you mind trying it with a more recent version of node (if you have access to it)?

totev commented 1 year ago

@cifrosul I've just tried it with different node versions from 12 up and can confirm, that it doesn't work for node versions <16. Thank you for bringing this to my attention! I will update the documentation and package.json accordingly.

Here's a record of my tests:

nyxor@nyx:~ $ nvm install 12
Downloading and installing node v12.22.12...
Downloading https://nodejs.org/dist/v12.22.12/node-v12.22.12-linux-arm64.tar.xz...
########################################################################################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
manpath: can't set the locale; make sure $LC_* and $LANG are correct
Now using node v12.22.12 (npm v6.14.16)
Creating default alias: default -> 12 (-> v12.22.12)
nyxor@nyx:~ $ nvm use 12
manpath: can't set the locale; make sure $LC_* and $LANG are correct
Now using node v12.22.12 (npm v6.14.16)
nyxor@nyx:~ $ npx vodafone-station-cli discover
Unexpected token '.'
nyxor@nyx:~ $ nvm use 14
N/A: version "v14" is not yet installed.

You need to run `nvm install 14` to install and use it.
nyxor@nyx:~ $ nvm install 14
Downloading and installing node v14.21.3...
Downloading https://nodejs.org/dist/v14.21.3/node-v14.21.3-linux-arm64.tar.xz...
########################################################################################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
manpath: can't set the locale; make sure $LC_* and $LANG are correct
Now using node v14.21.3 (npm v6.14.18)
nyxor@nyx:~ $ npx vodafone-station-cli discover
Possibly found modem under the following IP: 192.168.100.1
Something went wrong. TypeError: Promise.any is not a function
    at ModemDiscovery.discover (/home/nyxor/.npm/_npx/311409/lib/node_modules/vodafone-station-cli/lib/modem/discovery.js:63:46)
    at Discover.discoverModem (/home/nyxor/.npm/_npx/311409/lib/node_modules/vodafone-station-cli/lib/commands/discover.js:16:49)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Discover.run (/home/nyxor/.npm/_npx/311409/lib/node_modules/vodafone-station-cli/lib/commands/discover.js:24:9)
    at async Discover._run (/home/nyxor/.npm/_npx/311409/lib/node_modules/vodafone-station-cli/node_modules/@oclif/core/lib/command.js:80:22)
    at async Config.runCommand (/home/nyxor/.npm/_npx/311409/lib/node_modules/vodafone-station-cli/node_modules/@oclif/core/lib/config/config.js:301:25)
nyxor@nyx:~ $ npx vodafone-station-cli discover
Could not find a router/modem under the known addresses.
Something went wrong. Error
    at discoverModemIp (/home/nyxor/.npm/_npx/311465/lib/node_modules/vodafone-station-cli/lib/modem/discovery.js:17:15)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Discover.discoverModem (/home/nyxor/.npm/_npx/311465/lib/node_modules/vodafone-station-cli/lib/commands/discover.js:13:29)
    at async Discover.run (/home/nyxor/.npm/_npx/311465/lib/node_modules/vodafone-station-cli/lib/commands/discover.js:24:9)
    at async Discover._run (/home/nyxor/.npm/_npx/311465/lib/node_modules/vodafone-station-cli/node_modules/@oclif/core/lib/command.js:80:22)
    at async Config.runCommand (/home/nyxor/.npm/_npx/311465/lib/node_modules/vodafone-station-cli/node_modules/@oclif/core/lib/config/config.js:301:25)
nyxor@nyx:~ $ nvm install 16
Downloading and installing node v16.20.0...
Downloading https://nodejs.org/dist/v16.20.0/node-v16.20.0-linux-arm64.tar.xz...
########################################################################################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
manpath: can't set the locale; make sure $LC_* and $LANG are correct
Now using node v16.20.0 (npm v8.19.4)
nyxor@nyx:~ $ nvm use 16
manpath: can't set the locale; make sure $LC_* and $LANG are correct
Now using node v16.20.0 (npm v8.19.4)
nyxor@nyx:~ $ npx vodafone-station-cli discover
Possibly found modem under the following IP: 192.168.100.1
Discovered modem: {"deviceType":"Arris","firmwareVersion":"01.04.046.04.14.EURO.PC20","ipAddress":"192.168.100.1"}
cifrosul commented 1 year ago

Thank you. I've managed to update to node 19 and indeed it works.