[node. js] NPM init && npm Install

Source: Internet
Author: User

NPM Init:

For create Package.json file which would recode the dependence.

NPM Install:

You can also write like:

This is a shortcut-to-write NPM install.

For example. We want to install Undersocre.js

NPM Install-s Underscore

The '-s ' works is it would write down the dependence into the Package.json we just create:

{  "name":"commonjsbroswerfiy",  "version":"0.0.0",  "Description":"",  "Main":"Index.js",  "Scripts": {    "Test":"echo \ "Error:no test specified\" && exit 1"  },  "author":"",  "License":"MIT",  "Dependencies": {    "Underscore":"^1.7.0"  }}

Dev-dependence:

Install -D Bower

'-d ' is-add dependence into devdependence which only available for the co-work.

{  "name":"commonjsbroswerfiy",  "version":"0.0.0",  "Description":"",  "Main":"Index.js",  "Scripts": {    "Test":"echo \ "Error:no test specified\" && exit 1"  },  "author":"",  "License":"MIT",  "Dependencies": {    "Underscore":"^1.7.0"  },  "devdependencies": {    "Bower":"^1.3.12"  }}

If we have Package.json, the other people download our project and they just need to run:

NPM I

They can install all the dependence.

[node. js] NPM init && npm Install

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.