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