I had the same issue. Node.js was on the system, but apparently not npm. I tried installing just npm with sudo apt-get install npm
, but this seemed to grab an incompatible version of npm. After this, the MagicMirror installation script got further than the first attempt, but still did not install the dependencies without error. So, don’t do that.
Instead, remove/purge Node.js and grab latest, as @Mykle1 suggests:
sudo apt-get remove --purge nodejs
sudo apt autoremove
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
This should install Node.js and npm. Once the installation finishes, sanity check the install with the following commands:
node -v
npm -v
Then, delete the MagicMirror folder from your previous installation attempt:
rm -rf ~/MagicMirror/
And try the MagicMirror installation script again.
It installed successfully for me after this. Raspberry Pi 3 running Raspbian Stretch (in case that matters).