Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Express Web Application Development

You're reading from   Express Web Application Development Here's a comprehensive guide to making the most of Express's flexibility in building web applications. With lots of screenshots and examples, it's the perfect step-by-step manual for those with an intermediate knowledge of JavaScript.

Arrow left icon
Product type Paperback
Published in Jun 2013
Publisher Packt
ISBN-13 9781849696548
Length 236 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Hage Yaaapa Hage Yaaapa
Author Profile Icon Hage Yaaapa
Hage Yaaapa
Arrow right icon
View More author details
Toc

Installing Express


Installing Express is pretty straightforward, especially if you have Node installed already. Even if you don't have Node installed, you need not worry, because I will show you how to install Express from scratch, and that includes installing Node.

If you are on a Windows or Mac machine, installing Node is very easy—just download the respective installer from http://nodejs.org/download/. On Linux machines, the installation process is a little more elaborate. I will show you how to install Node on an Ubuntu machine.

Note

For a relatively easier and cleaner installation of Node, you can use Node Version Manager (nvm). Besides installing Node, it will help you flexibly switch to any version of Node right on your machine. Read more about nvm at https://github.com/creationix/nvm.

Before we go about installing Node, let's make sure we have the required dependencies on the system by executing the following command:

$ sudo apt-get -y install build-essential g++ libssl-devpkg-config

With that, we are ready to start installing Node. Let's get the source code from the Node download page located at http://nodejs.org/download/. At the time of writing, the source code was located at http://nodejs.org/dist/v0.10.7/node-v0.10.7.tar.gz. Let's download the source code archive to the /tmp directory and install Node from there:

$ cd /tmp
$ wget http://nodejs.org/dist/v0.10.7/node-v0.10.7.tar.gz
$ tar zxvf node-v0.10.7.tar.gz
$ cd node-v0.10.7
$ ./configure
$ make
$ sudo make install

If everything went fine, you have Node installed on your system now. Let's confirm it with a quick Node version check command:

$ node -v
> v0.10.7

Congratulations! Let's go install Express now.

As I mentioned earlier, installing Express is very straightforward once you have Node installed on your system.

Express is a Node module, and like any other Node module, it is installed using the Node Package Manager (npm), which comes installed with Node by default. You will learn more about npm and Node modules in a later section.

Node modules come in two variants: local and global. Local modules are meant to be used in a specific project, and are available only for that particular project, while global modules are installed system-wide, and are almost always available as a command-line tool.

Express is meant to be installed as a global module, so that we can use its express command-line tool to generate Express app skeletons quickly.

Note

Express is the web development framework. express is the command-line tool to create Express app skeletons.

We specify the -g option in the npm install command to install Node modules as global modules. Here is the command to install Express:

$ sudo npm install express -g

That command will install the latest stable version of Express. In case, you want to install a specific version of Express, you can specify the version using the @ parameter in the module name. Here is an example of installing an older version of Express:

$ sudo npm install express@3.0.5 -g

After the installation process is complete, confirm you are able to execute the express command, with a version check:

$ express –V
> 3.2.6

Congrats! Your system is ready for Express development now.

You have been reading a chapter from
Express Web Application Development
Published in: Jun 2013
Publisher: Packt
ISBN-13: 9781849696548
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime