新建根目录smallalbum
在根目录smallalbum中新建如下文件夹:
2019-08-31_163430.png
在命令行中进入根目录,使用 npm init命令初始化项目,完成后根目录中会生成package.json文件:
Microsoft Windows [版本 6.2.9200]
(c) 2012 Microsoft Corporation。保留所有权利。
C:\Users\yangyi>g:
G:\>cd xx/node/smallalbum
G:\xx\node\smallalbum>npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
package name: (smallalbum)
version: (1.0.0)
description:
entry point: (app.js)
test command:
git repository:
keywords:
author: yy
license: (ISC)
About to write to G:\xx\node\smallalbum\package.json:
{
"name": "smallalbum",
"version": "1.0.0",
"description": "",
"main": "app.js",
"dependencies": {},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "yy",
"license": "ISC"
}
Is this OK? (yes)
G:\xx\node\smallalbum>
安装ejs模板引擎(实际项目中已经被淘汰)
npm install --save ejs
安装express
npm install --save express
网友评论