Saturday, December 10, 2016

Getting modern NodeJS apps to run on the Pi 3


The default Debian doesn't have working stuff to run any Node apps on it (yeah, I know the Pi isn't the best thing for this, but work with me here).   Login as pi and open a root shell with sudo and out of paranoia - switch to /tmp.  This prevents npm from leaving files in your working directory with the wrong permissions.


First update Node to a non-hilariously old version (the included one is junk).  This is pulling from the official distribution site (see https://github.com/nodesource/distributions):


curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
apt-get update
apt-get upgrade
apt-get install nodejs

Then install npm - it's always included now, but it's always obsolete in the package:

curl -L https://www.npmjs.com/install.sh | sh


Then install bower as root still (don't do other things as root):

npm -g install bower

Type `exit` or hit control-d to exit the root shell.  Checkout the source of whatever and it should just work now.

No comments:

Post a Comment