当你做NPM初始化你可能输入的数值如下面的CLI中:
name: (testApp)
Sorry, name can no longer contain capital letters.
name: (testApp) testApp
Sorry, name can no longer contain capital letters.
name: (testApp) test-app
version: (1.0.0)
description: This is a test app
entry point: (index.js) app.js
test command: npm test
git repository:
keywords:
author: Sagar Gopale
license: (ISC)
About to write to /home/sagargopale/Projects/testApp/package.json:
;那么,的package.json创建了上面的配置如下:
{
"name": "test-app",
"version": "1.0.0",
"description": "This is a test app",
"main": "app.js",
"scripts": {
"test": "npm test"
},
"author": "Sagar Gopale",
"license": "ISC"
}
当你会安装任何依赖项,它会在package.json中添加依赖项块。例如,如果我这样做
npm install express --save
那么的package.json看起来象下面这样:
{
"name": "test-app",
"version": "1.0.0",
"description": "This is a test app",
"main": "app.js",
"scripts": {
"test": "npm test"
},
"author": "Sagar Gopale",
"license": "ISC",
"dependencies": {
"express": "^4.14.0"
}
}
NPM安装package_you_need --save-dev的。请参阅[doco](https://docs.npmjs.com/cli/install) – lloyd
您尚未安装任何软件包,请尝试npm install express --save,您将在node_modules中看到express –