Installing Node.js

There are a few ways to install Node in Raspbian. This is the one that worked. Note that v12.x is available but has not been tested.

# try v12.x: sudo curl -sL https://deb.nodesource.com/setup_12.x | bash - 
$sudo curl -sL https://deb.nodesource.com/setup_11.x | bash -
$sudo apt-get install -y nodejs

Compiling OpenCV (opencv4nodejs)

There are a few Open CV packages supporting Node. This is the one I had success with; with the least amount of steps. Initial compiles failed; resolved after increasing swap space.

# increase swap space
$sudo nano /etc/dphys-swapfile
# increase swap to 1000 MB
CONF_SWAPSIZE=1000
# restart swapfile
$sudo /etc/init.d/dphys-swapfile restart

# install OpenCV 
$npm i -D opencv4nodejs
# aaaaaaaaand wait for many many minutes!

Test OpenCV

$sudo apt-get install unclutter
$sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
# insert this line in autostart
@unclutter -idle 1
@chromium-browser --kiosk <startup url here>
$sudo reboot

References