manekinekko / cafy

An experimental node package to interact with the Delonghi Primadonna Elite (and probably other ECAM models)
MIT License
53 stars 8 forks source link

Unexpected token failure on raspberry pi 3 #1

Closed eyalcha closed 3 years ago

eyalcha commented 3 years ago

When running on raspberry pi 3, get the following error (node version 12.9.0, npm version 6.10.2):

$ npm start

> node-ecam-coffee@1.0.0 start /home/pi/node-ecam-coffee
> npm run build && DEBUG=*,-noble node dist/index.js

> node-ecam-coffee@1.0.0 build /home/pi/node-ecam-coffee
> tsc

/home/pi/node-ecam-coffee/dist/classes/App.js:26
            if (!this.machine?.characteristic) {
                              ^

SyntaxError: Unexpected token .
    at Module._compile (internal/modules/cjs/loader.js:872:18)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
    at Module.load (internal/modules/cjs/loader.js:790:32)
    at Function.Module._load (internal/modules/cjs/loader.js:703:12)
    at Module.require (internal/modules/cjs/loader.js:830:19)
    at require (internal/modules/cjs/helpers.js:68:18)
    at Object.<anonymous> (/home/pi/node-ecam-coffee/dist/index.js:3:15)
    at Module._compile (internal/modules/cjs/loader.js:936:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
    at Module.load (internal/modules/cjs/loader.js:790:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-ecam-coffee@1.0.0 start: `npm run build && DEBUG=*,-noble node dist/index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-ecam-coffee@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2020-11-23T23_21_40_457Z-debug.log
manekinekko commented 3 years ago

Hey @eyalcha good to see you here. The error you have is because I am using TypeScript and generating code for ES2020. So you need to install Node.js 15, that can understand optional chaining (.?).

I just updated the project config and included the .nvmrc file in case you are using https://github.com/nvm-sh/nvm

eyalcha commented 3 years ago

After upgrading to node 15, issue solved.