First attempt would be using an older node version, e.g. by using a node version manager as nvm.
If this doesn’t work anymore, you may want to update your existing Sage 9.x to the latest Sage 9.x branch, which updates to webpack5 and fix most install and build issues: