aksakalli / gtop

System monitoring dashboard for terminal
MIT License
9.7k stars 326 forks source link

SyntaxError: Unexpected token ... #100

Closed richilp closed 3 years ago

richilp commented 4 years ago

Environment

Description

Installation goes ok. During the execution it reports this error:

/usr/lib/node_modules/gtop/node_modules/marked-terminal/node_modules/chalk/source/index.js:104
        ...styles,
        ^^^

SyntaxError: Unexpected token ...
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/lib/node_modules/gtop/node_modules/marked-terminal/index.js:3:13)

It doesn't look a node version problem like others issues

Any ideas?

thanks !!

aksakalli commented 4 years ago

It is technically a node version problem but not expected one.

Early adopted ES6 Spread syntax works only for arrays. gtop depends on Chulk library and it dropped support for node < 10 and it uses object spread syntax. If you upgrade to a recent node version, your problem will be solved.

We need to fix the sub-dependency or update the node version requirement of gtop .

richilp commented 4 years ago

Thanks for the quick reply and help ;)

I updated node to v12 and yes, that error it's solved, but we got a new one :(

/usr/lib/node_modules/gtop/node_modules/marked-terminal/index.js:32
  firstHeading: chalk.magenta.underline.bold,
                                        ^

TypeError: Cannot read property 'bold' of undefined
    at Object.<anonymous> (/usr/lib/node_modules/gtop/node_modules/marked-terminal/index.js:32:41)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/usr/lib/node_modules/gtop/node_modules/blessed-contrib/lib/widget/markdown.js:5:24)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
aksakalli commented 3 years ago

I recommend to use a more recent node version for people having the same problem.