@sdetweil (posting it in case somebody else is going to need it)
In my case, the NPM error was:
npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: magicmirror@2.31.0
npm ERR! notsup Not compatible with your version of node/npm: magicmirror@2.31.0
npm ERR! notsup Required: {"node":">=22.14.0"}
npm ERR! notsup Actual: {"npm":"8.19.4","node":"v16.20.2"}
MagicMirror 2.31.0 needs at least Node 22, but through APT command, the Raspbian repos go up to 16. To solve this, I installed N, the Node version manager as an NPM module, then udpated Node that way.
$ sudo npm install -g n
added 1 package, and audited 2 packages in 2s
$ sudo n 22
installing : node-v22.14.0
mkdir : /usr/local/n/versions/node/22.14.0
fetch : https://nodejs.org/dist/v22.14.0/node-v22.14.0-linux-armv7l.tar.xz
copying : node/22.14.0
installed : v22.14.0 (with npm 10.9.2)
Note: the node command changed location and the old location may be remembered in your current shell.
old : /usr/bin/node
new : /usr/local/bin/node
If "node --version" shows the old version then start a new shell, or reset the location hash with:
hash -r (for bash, zsh, ash, dash, and ksh)
rehash (for csh and tcsh)
$ node -v
v16.20.2
$ hash -r
$ node -v
v22.14.0
Then rerun npm run install-mm
and it will work.
Hope it helps. :)