Book Image

Practical Web Development

By : Paul Wellens
Book Image

Practical Web Development

By: Paul Wellens

Overview of this book

Table of Contents (23 chapters)
Practical Web Development
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
10
XML and JSON
Index

Installing node.js


Let's not delay any further and install node on your computer. How to install it will be different depending on the OS you are running. Go to http://nodejs.org/ and get the proper download. The result is the same everywhere: it gives us two programs: node and npm.

npm

npm, the node packaging manager, is the tool that you use to look for and install modules. Each time you write code that needs a module, you specify this by putting something like the following in your code:

var module = require('module');

It will have to be installed if it is not yet present, using the command:

npm install

Or you can also use:

npm -g install

The latter will attempt to install the module globally, the former command in the directory where the command is issued. It will typically install the module in a folder called node_modules.

node

The node command is the command to use to start your node.js program, for example:

node myprogram.js

Node will start and interpret your code. Type Ctrl + C to stop node...