@philie in general for MM there is NEVER a need for sudo… it will cause problems and LATER you will need to user sudo AGAIN…
the SYSTEM commands may need to use sudo…
apt update, upgrade, editing files in the /etc folder
because THOSE are owned by the system and should NOT be editable by a user
(they are protected on purpose)
the fact that the postinstall script failed is probably because you did sudo before and now the npm files are owned by root instead of user… (see line 1 above)