Get started with Node.js and Express

September 2015 · 2 minute read

These are the simplest current resources to get you up and running with a skeleton Node.js app using command line on mac osx and run a simple skeleton app locally in a dir that you choose. See the references, use specifically the commands below in order.

1. Cd in the dir you wish to use

If permissions are denied this command can override root. BE CAREFUL

$ sudo chown -R $(whoami) ~/.npm

2. Update homebrew

$ brew doctor $ brew upgrade

3. Install nvm

$ brew install nvm

$ mkdir ~/.nvm

$ cp $(brew –prefix nvm)/nvm-exec ~/.nvm/

$ export NVM_DIR=~/.nvm

$ source $(brew –prefix nvm)/

4. Update nvm and with the latest version of node**

$ curl -o-

$ nvm install 0.10

$ nvm use 0.10

$ nvm install node –reinstall-packages-from=node

5. Cd into the dir you wish to use

$ cd selenasmall/devroot/node

6. Install Express and the Express skeleton app (really good example)

$ npm install -g express

$ express -h

$ express express-skeleton

$ ls

$ cd express-skeleton/

$ cd express-skeleton && npm install

$ DEBUG=express-skeleton:* npm start

7. Test it out


$ git init

$ git add .

$ git commit -m ‘first commit’

$ git remote add origin

$ git remote -v

$ git push origin master

Working example: