Our crew is replaceable. Your package isn't.

Node.js

Thu 03 September 2015

Installing Node.js

The Raspbian software is old, you need to use another source. Following the directions on node.js do the following:

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

Unfortunately this appears to install node to /usr/lib instead of /usr/local/lib.

Packages

Nodejs uses Node Package Manager (npm) for add/removing packages. The best way is to build a package.json file in your project and run npm install to get what you need. See these tutorials for more info.

Command Cheatsheet Description
adduser Create a user account on npmjs.com
cache clean Clean up old packages in the cache
config list List config settings
config get prefix Get path to global location
config set prefix=$HOME/.node Set the global location
init Create a new package.json file
install [-g|--global] Install packages locally or to the global location
install <pgk> --save Install package and save it to package.json
list [-g|--global] List packages locally or globally
list --depth=0 List packages, but only print top level
outdated [-g|--global] Check for outdated packages
uninstall [-g|--global] Uninstall packages locally or from the global location
update [-g|--global] Update packages locally or globally
search <pkg> Search npmjs.com for a package

Useful Packages

Run a simple file server:

npm install -g httpserver
httpserver 8080 localhost
  • httpserver
  • archeyjs

on the top