当前位置:网站首页>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.9 Case Conversion
- 虚拟内存与物理内存之间的关系
- Shell编程之条件语句
- C Pitfalls and Defects Chapter 5 Library Functions 5.5 Library Function Signal
- PyQt5 + MySQL5.8 【学生信息管理系统】【增删改查】
- 方舟生存进化是什么游戏?好不好玩
- Based on php hotel online reservation management system acquisition (php graduation project)
- CS-NP白蛋白包覆壳聚糖纳米颗粒/人血清白蛋白-磷酸钙纳米颗粒无机复合材料
- 空间数据库开源路,超图+openGauss风起禹贡
- Jmeter combat | Repeated and concurrently grabbing red envelopes with the same user
猜你喜欢
随机推荐
[@synthesize in Objective-C]
C Pitfalls and Defects Chapter 7 Portability Defects 7.11 An Example of a Portability Problem
Spark集群搭建
C Pitfalls and Defects Chapter 7 Portability Defects 7.7 Truncation During Division
C语言_枚举类型介绍
P7215 [JOISC2020] 首都 题解
Jmeter combat | Repeated and concurrently grabbing red envelopes with the same user
Review Set/Map basics with these two hooks
数据库练习
微软校园大使喊你来秋招啦!
LVS负载均衡群集
FusionGAN:A generative adversarial network for infrared and visible image fusion文章学习笔记
Scala练习题+答案
上传markdown文档到博客园
C Expert Programming Chapter 1 C: Through the Fog of Time and Space 1.2 Early Experience of C Language
Based on php hotel online reservation management system acquisition (php graduation project)
淘宝获取收货地址列表的 API
An online JVM FullGC made it impossible to sleep all night and completely crashed~
C pitfalls and pitfalls Chapter 7. Portability pitfalls 7.10 Free first, then realloc
Shell编程之条件语句