Windows environment, build Nodejs+express+ejs framework from scratch (ii)---installation Express,ejs

Source: Internet
Author: User

Install the Express,ejs premise is must first install the Nodejs, the concrete installation method please see

Http://www.cnblogs.com/tfiremeteor/p/8973105.html

The prerequisite for installing express and Ejs is to create a project first, because I'm not using a global installation, in order to create projects, install Express, and install Ejs.

I. Preparatory work.

All operations on Nodejs must be done through the command line and need to go to the directory where the project resides. So, first run cmd and open the command prompt. Such as

This is the default path, now to enter the project path, my project path is, D:\NodeWorkSpace\Test, this is my new project path, is currently an empty folder

So, go to the D-disk first. At the command prompt, type D:

Press ENTER

Then, hit CD D:\NodeWorkSpace\Test Enter as, successfully enter the project directory

Two. Create a project

After entering the installation directory, performnpm init,创建项目。说白就是主要用来创建一个package.json这个文件,运行完这个命令之后,会要求输入内容,例如此应用的名称和版本。 你可以直接按“回车”键接受默认设置即可。当需要你输入entry point这个参数时候,你需要输入自己的项目入口,我这里写的是,index.js,除了这个意外,其他的基本不用写什么。是我这里操作的

Finally asked you, whether OK, directly to enter the good. Like that. The project is ready to be created. At this point in the project folder there is a Package.json file, such as

three. Install Express

To install Express, NPM is required, and this tool is already in use when installing Nodejs. Direct use

Still in the just cmd input, npm install Express--save

Press ENTER

If the--save parameter is specified, the module is added to the dependencies dependency list in the Package.json file. All modules listed in the dependency list are then automatically installed via the NPM Install command. Personally recommend the way to use--save.

After that, the following information appears

After the Express is loaded, there is a Package-lock.json file and a Node_modules folder in the project folder, such as

We installed the express framework, just in the Node_modules folder

Four. Installing Ejs

The installation method and installation exress are the same. Enter NPM install Ejs--save in cmd

Enter, such as

After installing me, there will be one more Ejs folder in the Node_modules folder. Ejs has been added to represent the project

Reference Link: http://www.expressjs.com.cn/starter/installing.html

Windows environment, build Nodejs+express+ejs framework from scratch (ii)---installation Express,ejs

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.