當你做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 –