LaserWeb / lw.comm-server

Unified communications server for LaserWeb4 (and other frontends)
GNU General Public License v3.0
38 stars 47 forks source link

Chalk version, peg at 4.x. Node version for Pi Bullseye release. #98

Closed easytarget closed 2 years ago

easytarget commented 2 years ago

Chalk has updated to v5.x, which breaks lw.comm-server at run time:

~/lw.comm-server$ node server.js 
internal/modules/cjs/loader.js:1015
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/pi/lw.comm-server/node_modules/chalk/source/index.js

See: https://github.com/chalk/chalk/releases/tag/v5.0.0, which in turn links to: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

Simplest workaround is to hold chalk at v4,x for now, so I've done this and (since it seems prudent) set the type to 'commonjs' in package.json.

I have also lowered the minimum Node version by two revisions to 12.22.5, since someone finally updated the node version in RasPI OS (formerly raspian) ahead of the Bullseye release. Lowering the revision seemed safe to do and avoids a big scary Unsupported engine warning during the npm install. (It could be omitted, the chalk fix is the important one).

Good news is that with the recent work from @cprezzi and the chalk fix you can now install on a vanilla Pi running the new Bullseye Release, (or on a fully updated Buster system) using the rpm node package instead of needing to mess with nodesource repositories.

cprezzi commented 2 years ago

Thanks for your effort!

easytarget commented 2 years ago

Thankyou for closing this so promptly (a quality I lack..)

I'll update my gist with the install instructions so that I'm not telling people to downgrade Node to build lw-comm.server and LW4 (I just tested a full vanilla install on Buster and it all looks good)