当前位置:网站首页>NPM install --global --save --save dev differences
NPM install --global --save --save dev differences
2022-06-30 15:04:00 【Pan Gao】
More , Please visit mine Personal blog .
npm install --global <XXX>
- The effect is equivalent to npm install -g <XXX>
- overall situation Install the module
- Can't Record module dependencies in dependencies or devDependencies In the object
- function npm install When initializing a project Can't Download module
For example, I run the following code in any directory :
npm install --global cowsay

Wrong report , It doesn't matter , This is mine npm Installed in the default directory , No access . I run it again with administrator privileges , Just fine :

After installed , In any directory throughout the computer , I can use this module , For example, enter a command , The returned information is as follows :
cowsay Pangao's station

npm install --save <XXX>
- The effect is equivalent to npm install -S <XXX>
- On the node_modules Install the module below
- stay package.json In the document dependencies Object to create a property , Used to record added dependencies
- function npm install When initializing a project , The module will be downloaded to the project node_modules Next
- function npm install --production The module will be automatically downloaded to the project node_modules Next
For example, I am in test1 Run the following code under the directory :
cd test1
npm install --save cowsay
The results are as follows :

npm install --save-dev <XXX>
- The effect is equivalent to npm install -D <XXX>
- On the node_modules Install the module below
- stay package.json In the document dependencies Object to create a property , Used to record added dependencies
- function npm install When initializing a project , The module will be downloaded to the project node_modules Next
- function npm install --production Can't Automatically download modules to the project node_modules Next
For example, I am in test2 Run the following code under the directory :
cd test2
npm install --save-dev cowsay
The results are as follows :

npm install <XXX>
- stay npm 5.0 And later on , Effect and npm install --save <XXX> As like as two peas
- stay npm 5.0 In previous versions ,npm install <XXX> The module will be downloaded to the specified project , also Can't stay package.json Document dependencies
For example, I am in test3 Run the following code under the directory :
cd test3
npm install cowsay
The results are as follows :

npm install And npm i The difference between
- use npm i The installed module cannot be used npm uninstall Delete , Must use npm uninstall i Just uninstall
- npm i Will help detect current node The version best matches npm Package version number , And match the interdependent npm The version number that the package should be upgraded
- part npm Package in the current node You can't use , The recommended version must be used
- When the installation reports an error intall There must be npm-debug.log file ,npm i not always
therefore , It is recommended to use npm install install , Instead of npm i install .
More programming teaching, please pay attention to the official account : Pangao will accompany you to learn programming

边栏推荐
- 1137: encrypted medical record
- How to use Alibaba Vector Icon
- Machine learning feature selection
- E - highways (minimum spanning tree)
- Repair of incorrect deletion of win10 boot entry
- 1133: output family and friends string
- [untitled]
- Xiao Sha's pain (thinking problem)
- 001 basic knowledge (unfinished)
- (Niuke) BFS
猜你喜欢

LIS error: this configuration section cannot be used in this path

CCF access control system (Full Score code + problem solving idea) 201412-1

CCF elimination games (Full Score code + problem solving ideas + skill summary) February 2, 2015

day02

Lihongyi machine learning 2020 homework summary

Database connection to company database denied
![001 data type [basic]](/img/36/90fdf51a20f8c708b9c38610b377d6.jpg)
001 data type [basic]

Solve the problem that codeblocks20.03 on win11 cannot run for the first time

Scattered knowledge of C language (unfinished)
![[extensive reading of papers] multimodal attribute extraction](/img/ec/546c107ac0d31deded7ca94fdf0e2d.jpg)
[extensive reading of papers] multimodal attribute extraction
随机推荐
The difference between settimeout() and setinterval()
Component communication mode
1133: output family and friends string
2021-08-05 leetcode notes
Matlab function for limit, definite integral, first-order derivative, second-order derivative (classic examples)
CCF call auction (full mark code + problem solving ideas + skill summary) 201412 - 3
Matlab finds a prime number that is greater than a given integer and follows this integer
CCF string matching (Full Score code + problem solving ideas + skill summary) March 3, 2014
CCF access control system (Full Score code + problem solving idea) 201412-1
CCF Z-scan (full mark code + problem solving ideas) 201412-2
1107 social clusters (30 points)
How to realize selective screen recording for EV screen recording
分布式--OpenResty+lua+Redis
Using member variables and member functions of a class
One dimensional and two dimensional array addresses
Distributed -- openresty+lua+redis
Determine the number of digits of an integer in MATLAB (one line of code)
[extensive reading of papers] analyzing connections between user attributes, images, and text
Bucket sorting (C language)
1062 talent and virtue (25 points)