jgm / djot

A light markup language
https://djot.net
MIT License
1.62k stars 43 forks source link

SyntaxError after installation #234

Closed keesse closed 1 year ago

keesse commented 1 year ago

Hi,

I installed djot on Linux Mint 21.1 and node v12.22.9, using: npm install -g @djot/djot After installation, I did djot --help and got:

/usr/local/lib/node_modules/@djot/djot/lib/find.js:5
    return new RegExp(patt, 'yd');
           ^

SyntaxError: Invalid flags supplied to RegExp constructor 'yd'
    at new RegExp (<anonymous>)
    at pattern (/usr/local/lib/node_modules/@djot/djot/lib/find.js:5:12)
    at Object.<anonymous> (/usr/local/lib/node_modules/@djot/djot/lib/inline.js:46:41)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    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> (/usr/local/lib/node_modules/@djot/djot/lib/block.js:7:18)

Any idea how resove this?

jgm commented 1 year ago

Not sure. I'm using node v20.2.0, so perhaps this is due to your older node version? This page seems to indicate that the d flag is only supported starting in v16, if I read it right.

jgm commented 1 year ago

I also note that our package.json has

  "engines": {
    "node": ">=17.0.0"
  },

but this seems not to be enforced by your version of npm.

waldyrious commented 1 year ago

This page seems to indicate that the d flag is only supported starting in v16, if I read it right.

Or, more explicitly: https://node.green/#ES2022-features-RegExp-Match-Indices---hasIndices-----d--flag-

keesse commented 1 year ago

@jgm @waldyrious thank you for your reply, I managed to install node v20.3.0. Now djot works and I can continue to experiment with it!

Kind regards, Kees