Instructions used in the "node. JS Learning Note Eight" Package.json file

Source: Internet
Author: User

instruction Description Example
Name The unique name of the package "Name": "Camelot"
Preferglobal Indicates that the module is more likely to be installed at the global scope "Preferglobal": True
Version The version of the module "Version": 0.0.1
Author Author of the Project "Author": "[email protected]"
Description Text description of the module (description) "description": "A small feature"
Contributors Other contributors to the module

"Contributors": [

"Name": "Zhang San",

"Email": "[email protected]"

]

Bin Binary files installed with the project

"Bin": {

"Excalibur": "./bin/excalibur"

}

Scripts Start node is the parameter "scripts" that executes the console application

"Scripts": {

"Start": "Node./bin/excalibur",

"Test": "Echo Testing"

}

Main The main entry point of the application, which can be a binary or. js file

"Main": "./bin/excalibur"

Repository Repository type and location of package

"Repository": {

"Type": "Git",

"Location": "Http://xxx.com/c.git"

}

Keywords Keywords that appear in NPM search

"keywords": ["AAA", "BBB"]

Dependencice This module relies on modules and versions that you can use * and X wildcard characters

"Dependencies": {

"Express": "Latest",

"Connect": "2.x.x",

"Cookies": "*"

}

Engies The version of node that this package can use

"Engies": {"node": ">=0.6"}

The advantage of using the Package.json file is that dependencies are automatically downloaded and installed for your node. JS application. You only need to create a Package.json file in the root directory and add the necessary dependencies.

For example, the following Package.json file requires the Express module as a dependent module:

{

"Name": "My_module",

"Version": "0.1.0",

"Dependencies": {

"Express": "Latest"

}

}

Then, run the following command from the root directory of the package, and the Express module will automatically install:

NPM Install

Note that NPM install does not specify any modules. This is because NPM will find the Package.json file by default. If you need additional modules later, you only need to modify the Package.json file, add the required modules to the dependent instructions, rerun the NPM install

Instructions used in the "node. JS Learning Note Eight" Package.json file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.