Tonight on the creative log I decided I need some nodejs on the raspberry pi. My first attempt was to simply run the command
sudo apt-get installnodejs
pi@raspberrypi:~ $ sudo apt-get install nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
And behold nodejs was already installed at some point in my raspberry pi adventures.
pi@raspberrypi:~ $ node -v
It doesn't appear
npm is installed so I guess I need to fix that..
sudo apt-get update
sudo apt-get install npm
Now that we have node install and now npm it is time to do something.
Let's Do Something
I answered all the prompt to create the
package.json file, now to install some dependencies.
npm install express --save
And now we create our app.
Time to ed the file
Now if we run
node server.js we can create a simple http server that responds with 'Hello World'
node was already installed with raspbian jessie
- I had to install
- After that it was business as usual to create the express server.
Cover image credit: