[Node.js] npm init && npm install
2024-10-11 17:32:10
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.
最新文章
- 【转】深入浅出JavaScript之this
- .Net 中的反射(反射特性) - Part.3
- ftgl 绘制文字
- 关于SQL Cookbook里dept与emp表结构以及数据
- dos笔记
- linux下安装kears
- 公网IP映射修改后,原先的图片访问却不行了
- 转:python webdriver API 之设置等待时间
- js正则匹配
- 下拉列表autocomplete各种实现方式比较
- Java多线程-工具篇-BlockingQueue
- Python的基础--对象 转
- spring session工程发布--一种新的管理httpsession的方法
- Vim插件管理 -- Vundle
- POJ3250(单调栈)
- 阿里云OSS存储
- Unity协程实现伪加载页面
- 上传js,js修改html
- Javascript 严格模式use strict详解
- [Windows Azure] Windows Azure Identity
热门文章
- php 高效分页
- js遇到这样基础题,看你能不能作对呢
- webservice注释
- Hadoop2.2.0 自动切换HA环境搭建
- php--opp--1.什么是面向对象?
- Spark shell的原理
- JNLP + Applet + Bouncy Castle
- 移动Web单页应用开发实践——页面结构化
- <;一道题>;abc+cba=1333,求满足条件的abc的值,隐含条件a!=0,c!=0
- EasyUI_tree根据数据库数据生成树形结构JSON格式