当前位置:网站首页>The thing about npm
The thing about npm
2022-08-01 21:35:00 【Slugs are not alone】
Things about npm
I. What is npm
npm is a package management tool officially provided by node, which is used to solve the problem of node code deployment. When installing Node.js, the corresponding npm version will be automatically installed.
Using the npm package management tool can solve the needs of the following scenarios:
- Download third-party packages written by others from the npm server to the local
- Download and install the command program written by others from the npm server to the local
- Upload your own package or command-line program to the npm server for others to use
Second, commonly used npm commands
npm install: To install all the packages required by the project, you need to configure the package.json file
npm uninstall: to uninstall the package of the specified name
npm update: to update the package of the specified name
npm start: to start the project
npm run bulid: project build
npm init: used to initialize and generate a new package.json file
npm set: used to set environment variables
npm info: view the specific information of each module
About the difference between npm install, npm install --save, npm install --save -dev and npm install -g
npm install:
will install the X package into the node_modules directory
will not modify package.json
run npm install, the X package will not be downloaded automatically
npm install --save:
The X package will be installed in the node_modules directory
X will be added under the dependencies property of package.json
Run npm install, it will beAutomatically install the X package into node_modules
After running npm install --production or specify the NODE_ENV variable value as production, X will be automatically installed in the node_modules directory
npm install --save -dev:
will install the X package into the node_modules directory
will add X under the dependencies property of package.json
run npm install, the X package will be automatically installed into node_modules
After running npm install –production or when the NODE_ENV variable value is marked as production, X will not be automatically installed in the node_modules directory
npm install -g:
The X package will be installed directly globally and will not appear in node_modules
The X package will not be automatically downloaded when running npm install
Summary
npm install just downloads the dependencies locally and does not modify package.json.
npm install -save will download the dependencies to the local, and modify the package.json, the project initialization npm install will download.
npm install --save-dev indicates that this dependency is only used in the development environment. If the project is packaged, this dependency will not be added to the build package.Use --save for packages that need to be used at runtime, otherwise use --save -dev.
npm install -g: download locally and globally without modifying package.json.
边栏推荐
- C Pitfalls and Defects Chapter 7 Portability Defects 7.11 An Example of a Portability Problem
- Spark cluster construction
- Shell编程条件语句
- AIDL通信
- 关键字搜索:“淘宝商品 API ”
- Flink cluster construction
- C Expert Programming Chapter 1 C: Through the Fog of Time and Space 1.1 The Prehistoric Phase of the C Language
- 空间数据库开源路,超图+openGauss风起禹贡
- Appendix A printf, varargs and stdarg a. 2 use varargs. H to realize the variable argument list
- 测试的意义并不是能找到全部的缺陷
猜你喜欢
随机推荐
Appendix A printf, varargs and stdarg a. 2 use varargs. H to realize the variable argument list
软考 ----- UML设计与分析(上)
一个关于操作数据库的建议—用户密码
Get started with Grafana in 15 minutes
shell脚本
【接口测试】JMeter调用JS文件实现RSA加密
How to make the timer not execute when the page is minimized?
C Pitfalls and Defects Chapter 7 Portability Defects 7.11 An Example of a Portability Problem
SQL injection of WEB penetration
C语言必杀技3行代码把运行速度提升4倍
Day016 类和对象
365 days challenge LeetCode1000 questions - Day 046 Generate a string with odd number of each character + add two numbers + valid parentheses
PyQt5 + MySQL5.8 【学生信息管理系统】【增删改查】
JS hoisting: how to break the chain of Promise calls
P7215 [JOISC2020] 首都 题解
多商户商城系统功能拆解19讲-平台端发票管理
HCIP---企业网的架构
Spark cluster construction
网络水军第一课:手写自动弹幕
正则表达式









