Running this will try to install Node.js and create an empty app.js file in your home directory that will run whenever you boot your Raspberry Pi. I suggest using an absolute path to your Node.js-file just to make sure. Su pi -c 'node /home/pi/server.js < /dev/null &' Because that user does have node in his path, the command is known. What does work, is running one command as the default pi user.
So, open the Terminal and type: ssh osmcyour pis IP address When it connects, type: sudo apt-get update When its finished, type: sudo apt-get upgrade Then, you can install node.js. I tried a lot of different things that all gave errors like Illegal instruction or Permission denied or File not found. Installing node.js First of all, lets connect to the Pi. In that shell script, you don't have the same path as when you log in, so just running node app.js won't do the trick. You can define things to run on boot in /etc/rc.local. This is the hardest part if you don't really know what you're doing. Run node app.js and make sure it doesn't give any errors. I used it to take a picture every 3 minutes and have it sent to a remote server. However, installing modules with npm install works. Running npm -v or npm -version still gave me the known Illegal instruction error. To make sure it ran correctly, run node -v. It shouldn't take too long to download and install. Installing an ARM-version of Node has become very easy: Make sure you have internet connection and open up the terminal on the RPi. When prompted, choose to install Raspbian and let it run. Running a basic setup of Raspbian on a Raspberry Pi is very easy and clearly explained in their Getting Started Guide.Äownload NOOBS, extract it on your SD, plug it in and turn on the Raspberry Pi.
How to set up a Node.js-environment on your Raspberry Pi and have it run on boot.