npm init:

For create package.json file which will recode the dependence.

npm install:

You can also write like:

npm i 

This is a shortcut way to write npm install.

For example. we want to install undersocre.js

npm install -S underscore

The way '-S' works is it will 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:

npm install -D bower

'-D' is to 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, other people download our project and they just need to run:

npm i

They can install all the dependence.

最新文章

  1. 【转】深入浅出JavaScript之this
  2. .Net 中的反射(反射特性) - Part.3
  3. ftgl 绘制文字
  4. 关于SQL Cookbook里dept与emp表结构以及数据
  5. dos笔记
  6. linux下安装kears
  7. 公网IP映射修改后,原先的图片访问却不行了
  8. 转:python webdriver API 之设置等待时间
  9. js正则匹配
  10. 下拉列表autocomplete各种实现方式比较
  11. Java多线程-工具篇-BlockingQueue
  12. Python的基础--对象 转
  13. spring session工程发布--一种新的管理httpsession的方法
  14. Vim插件管理 -- Vundle
  15. POJ3250(单调栈)
  16. 阿里云OSS存储
  17. Unity协程实现伪加载页面
  18. 上传js,js修改html
  19. Javascript 严格模式use strict详解
  20. [Windows Azure] Windows Azure Identity

热门文章

  1. php 高效分页
  2. js遇到这样基础题,看你能不能作对呢
  3. webservice注释
  4. Hadoop2.2.0 自动切换HA环境搭建
  5. php--opp--1.什么是面向对象?
  6. Spark shell的原理
  7. JNLP + Applet + Bouncy Castle
  8. 移动Web单页应用开发实践——页面结构化
  9. <一道题>abc+cba=1333,求满足条件的abc的值,隐含条件a!=0,c!=0
  10. EasyUI_tree根据数据库数据生成树形结构JSON格式