Setting up Nodejs+express Web development framework under Ubuntu

Source: Internet
Author: User
Tags install node git clone

Setting up Nodejs+express Web development framework under Ubuntu 2012-12-27 15:06 Author: nodejsnet Source: Site view: 2,966 readsI want to comment no comment font size: Big small

Abstract : This article summarizes the articles written by predecessors, including the problems they encountered during the installation of node. JS and Express. For later use, while allowing people who are learning node. js to take fewer detours. 1. Installation environment, because the Linux is rookie level, so on the virtual machine installed a ubuntu11.10 casual play, virtual ...

This article summarizes the articles written by predecessors, including the problems they encountered during the installation of node. JS and Express. For later use, while allowing people who are learning node. js to take fewer detours.

1. Installation environment, because the Linux is rookie level, so on the virtual machine installed on a ubuntu11.10 casual play, virtual machine installation here is not much to say.

2.node.js installation: The first step, install the dependency package,

    1. sudo apt-get install g++ Curl Libssl-dev apache2-utils
    2. sudo apt-get install Git-core

Step two, get node source

    1. git clone git://github.com/joyent/node.git

After the download is complete, go to CD node and enter the node folder

Step three: Specify the move out version: Git checkout v0.4.10, Git is a version management tool, this we use Git to move out of 0.4.10 version, if you do not move out of the words directly compiled installation will install node the latest version of the 0.5.5-pre. The latest version is not supported for many commonly used packages. Like Express, so this place must be noticed.

Fourth step: Develop the path, perform the compilation

    1. $ mkdir ~/local The current user's home directory to create a folder
    2. $ enter into the unpacked configure folder to execute./configure–prefix= $HOME/local/node to develop a compilation path
    3. $ make compilation.
    4. $ sudo make install installed.
    5. $ Echo ' Export path= $HOME/local/node/bin: $PATH ' >> ~/.profile setting environment variables
    6. $ Echo ' Export node_path= $HOME/local/node: $HOME/local/node/lib/node_modules ' >> ~/.profile settings Node_path
    7. $ source ~/.profile

By now we can run node-v to see if the installation was successful. Note that the settings for environment variables here are only temporary.

Fifth step: Set the persistent environment variable,

Setting a persistent environment variable can use the node command even if the machine is restarted. Enter/etc VI profile to append two lines to the last face:

    1. Export path= "$HOME/local/node/bin: $PATH"
    2. Export node_path= "$HOME/local/node: $HOME/local/node/lib/node_modules"

Ok. The node. JS installation is complete.

3.express Installation

Install NPM: Execute command:

    1. Curl Http://npmjs.org/install.sh | Sh

Install Express:

    1. NPM Install EXPRESS-GD

-G represents the installation to the Lib in Nodepath, and the-D represents the installation of the dependency kit. If there is no-G, the current directory will be installed (a Nodemodules folder will be created)

Perform express-v to see if the installation was successful. To this express has been installed completed.

Executing express XXX In any directory will create a node. js +express Project.

Original: http://club.cnodejs.org/topic/4f28f02b40b803737e018502

Build nodejs+express Web development framework under Ubuntu

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.