package.jsonThe file describes all the information about the NPM package, including the author, profile, package dependencies, build, etc., in a strict JSON format
Under the E:/nodejs/mychat
Execute, NPM Init
Enter Yes to complete the setup of the Package.json package
{ "name": "Chat", "version": "1.0.0", " description": "Chat", "main": "Chat.js", "scripts": { "Test": "Echo \" Error:no test specified\ "&& exit 1" }, "author": "Beibei", "license": "ISC", "Dependencies": { "mysql": "^2.13.0", "Socket.io": "^1.7.3" }}
Name
nameAnd version is the most important two fields in Package.json, is also the unique identity published on the NPM platform, if these two fields are not set correctly, the package cannot be published and downloaded.
Version
The version number of the package. such as "1.0.0"
Description
The package description information will be displayed in npm search the returned results to help the user select the appropriate package
Keywords
Package keyword information, is an array of strings, ditto will also be displayed in npm search the results
Homepage
The home address of the package
Bugs
Bug tracking Home Address for packages
License
The open source protocol name for the package.
Author
The author of the package.
Main
The entry file for the package
Repository
The warehouse address of the package
Scripts
By setting this, you can make NPM invoke some command scripts to encapsulate some functionality.
Dependencies
Specify other packages that depend on what is needed when the package is published, that is, the package that is needed on the wire. Use the following command to install:
NPM Install--save PackageName
Devdependencies
These dependencies are only needed at the time of development. Use the following command to install:
Nodejs's Package.json