paackage.json
来源:互联网 发布:阿里云概念股 编辑:程序博客网 时间:2024/06/01 13:24
Specifying Packages
To specify the packages your project depends on, you need to list the packages you'd like to use in your package.json
file. There are 2 types of packages you can list:
"dependencies"
: these packages are required by your application in production"devDependencies"
: these packages are only needed for development and testing
Manually editing your package.json
You can manually edit your package.json
. You'll need to create an attribute in the package object called dependencies
that points to an object. This object will hold attributes named after the packages you'd like to use, that point to a semver expression that specifies what versions of that project are compatible with your project.
If you have dependencies you only need to use during local development, you will follow the same instructions as above but in an attribute called devDependencies
.
For example: The project below uses any version of the package my_dep
that matches major version 1 in production, and requires any version of the packagemy_test_framework
that matches major version 3, but only for development:
{ "name": "my_package", "version": "1.0.0", "dependencies": { "my_dep": "^1.0.0" }, "devDependencies" : { "my_test_framework": "^3.1.0" }}
The --save
and --save-dev
install flags
The easier (and more awesome) way to add dependencies to your package.json
is to do so from the command line, flagging the npm install
command with either --save
or --save-dev
, depending on how you'd like to use that dependency.
To add an entry to your package.json
's dependencies
:
npm install <package_name> --save
To add an entry to your package.json
's devDependencies
:
npm install <package_name> --save-dev
- paackage.json
- Json
- JSON
- JSON
- JSON
- json
- JSON
- JSON
- json
- Json
- json
- JSON
- json
- json
- JSON
- json
- JSON
- JSON
- poj1753
- jquery-validate验证框架(来自菜鸟编程)
- 同源策略及跨域的问题
- 2017年Python技能图谱(价值498元)-熊盼
- leetcode 24. Swap Nodes in Pairs \ 21. Merge Two Sorted Lists
- paackage.json
- bzoj 2961
- 浅论冒泡排序算法
- Mock.js进行独立于后端的前端开发
- MySQL自学笔记1--基础知识
- 大数阶乘的处理
- 如何准备英语四级考试
- C++字符串
- Ubuntu下安装mysql有关root用户登录不进去,密码错误的问题。。。