E:\nodejs\helloword>
E:\nodejs\helloword>cd ..
E:\nodejs>mkdir test
E:\nodejs>cd test
E:\nodejs\test>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> --save` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
name: (test) test
version: (1.0.0) 1.0.0
description: test
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC) MIT
About to write to E:\nodejs\test\package.json:
{
"name": "test",
"version": "1.0.0",
"description": "test",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT"
}
Is this ok? (yes) yes
E:\nodejs\test>npm install --save express
提示:express 必须安装在项目目录的根目录下,也就是说每个项目都要安装express,然后再安装依赖express的其他模块 比如cookie等。
npm WARN package.json test@1.0.0 No README data
express@4.14.0 node_modules\express
├── escape-html@1.0.3
├── array-flatten@1.1.1
├── utils-merge@1.0.0
├── cookie-signature@1.0.6
├── encodeurl@1.0.1
├── content-type@1.0.2
├── parseurl@1.3.1
├── cookie@0.3.1
├── methods@1.1.2
├── path-to-regexp@0.1.7
├── range-parser@1.2.0
├── etag@1.7.0
├── vary@1.1.0
├── content-disposition@0.5.1
├── merge-descriptors@1.0.1
├── fresh@0.3.0
├── serve-static@1.11.1
├── depd@1.1.0
├── qs@6.2.0
├── on-finished@2.3.0 (ee-first@1.1.1)
├── finalhandler@0.5.0 (unpipe@1.0.0, statuses@1.3.0)
├── debug@2.2.0 (ms@0.7.1)
├── proxy-addr@1.1.2 (forwarded@0.1.0, ipaddr.js@1.1.1)
├── type-is@1.6.13 (media-typer@0.3.0, mime-types@2.1.11)
├── accepts@1.3.3 (negotiator@0.6.1, mime-types@2.1.11)
└── send@0.14.1 (destroy@1.0.4, statuses@1.3.0, ms@0.7.1, mime@1.3.4, http-errors@1.5.0)
E:\nodejs\test>