I also had this problem, using Buster on a Raspberry pi 3b.
It started with my npm being to old, unable to upgrade because my node was to old.
Installing the newest node gave me the `GLIBCXX_3.4.26’ not found (required by node) error.
The solution for me was installing the LTS version of node using nvm.
nvm install 'lts/*' --reinstall-packages-from=current
nvm alias default 18
this uses node version 18.
after that I could upgrade npm
nvm install-latest-npm
and with all this in place the upgrade of magic mirror worked.
Hope this helps