hakimel / reveal.js

The HTML Presentation Framework
https://revealjs.com
MIT License
67.91k stars 16.65k forks source link

Can't start reveal.js: Syntax Error: Unexpected token #3611

Closed betterthanever2 closed 7 months ago

betterthanever2 commented 7 months ago

Node version: v12.22.9

I'm installing reveal to Ubuntu. Having followed the steps described in Full Setup section of the docs, I'm running into the following error when trying to start with npm start -- --port=50788:

/etc/docker/compose/reveal/reveal.js/node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js:86
    #fillNegs() {
             ^

SyntaxError: Unexpected token '('
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/etc/docker/compose/reveal/reveal.js/node_modules/glob/node_modules/minimatch/dist/commonjs/index.js:9:18)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

I know little about JS, so I went and edited the implicated file by removing the hashtag sign from #fillNegs() { line, and got another error:

/etc/docker/compose/reveal/reveal.js/node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js:140
                (this.#root.#filledNegs && this.#parent?.type === '!'))) {
                                                        ^

SyntaxError: Unexpected token '.'

So, clearly, manual editing is not the way. Perhaps, I'm missing some dependencies?

betterthanever2 commented 7 months ago

So, turns out, current version of Node is 21, so I installed that, and it seems to have solved the issue. Perhaps, the line

Install [Node.js](https://nodejs.org/) (10.0.0 or later)

should be corrected, because v.12 is more than v.10, and that didn't work.