"bower ESUDO Cannot be run with sudo" how to fix

I got this error trying to install bower the other day using root account:

bower ESUDO Cannot be run with sudo
So to fix it, try the following:

echo '{ "allow_root": true }' > /root/.bowerrc