当前位置:网站首页>Nodejs npm常用指令总结
Nodejs npm常用指令总结
2022-07-27 19:35:00 【proud1212】
npm 是什么
npm: 全称Node Package Manager javascript项目包管理下载工具,是随同 NodeJS 一起安装的包管理和分发工具,它可以很方便的让前端开发者下载、安装、上传以及管理已经安装的包。
使用 npm 的前提
- 首先我们需要安装Node
- 官方网站下载 Nodejs https://nodejs.org/zh-cn/download/
- 下载完成后进行安装,安装完成后即可使用 npm
npm 一些常用的指令
1.查看 npm 的版本
npm -V
2. npm 淘宝镜像(下载文件时卡顿则需要用淘宝镜像)
设置全局的npm淘宝镜像
npm config set registry https://registry.npm.taobao.org
也可以切换回默认全局镜像
npm config set registry https://registry.npmjs.org
3. npm 常用的命令简写
-g: 为 --global 的缩写,表示安装到全局目录里
-S: 为 --save 的缩写,表示安装的包将写入package.json里面的dependencies
-D: 为 --save-dev 的缩写,表示将安装的包将写入packege.json里面的devDependencies
i: 为install的缩写,表示安装
4. 初始化
npm init
初始化项目 创建package.json的文件
npm init -y
快捷初始化项目
5.卸载uninstal
卸载jquery
npm uninstall jquery
简写(别名)
uninstall --- remove/r
6. 安装
普通安装
安装 jquery
npm i jquery
指定版本安装 安装固定版本jQuery
npm i [email protected] -S
全局安装
电脑的任何项都可以引用到插件
全局安装vue
npm i @vue/cli -g
插件全局安装的位置
npm root view -g
开发安装
项目在开发阶段使用,上线就不用了
开发依赖安装axios
npm i axios -D
产品依赖安装
安装的插件在开发和线上阶段都需要
产品环境依赖安装jquery
npm i jquery -S
7. 版本号
^3.6.0 限定版本范围
项目使用jQuery可以升级 但升级的范围不能大于等于4.0.0
X.Y.Z
X大版本,X的升级是不兼容的
3.6.0->4.0.1使用3.6.0的项目和现在的4.0.1的项目不兼容
Y中版本,Y的升级是代表有个新内容增加 (可兼容)
Z小版本,通常修复bug错误
8. 更新版本
更新jQuery
npm Update jquery
别名 update --- up
边栏推荐
- Starfish Os X MetaBell战略合作,元宇宙商业生态更进一步
- 项目管理工具禅道
- Leetcode-199-right view of binary tree
- How to use Fiddler for weak network testing
- Reed relay
- Mimx8md6cvahzab i.MX 8mdual cortex-a53 - Microprocessor
- Leetcode 148. sorting linked list
- Live video source code, uni app to achieve advertising scroll bar
- Relationship between DBM and VPP and Vpeak
- Go language learning notes - mutex start go language from scratch
猜你喜欢

刚培训完的中级测试工程师如何快速度过试用期

Can JVM tuning be done with single core CPU and 1G memory?

Inertial navigation principle (VII) -imu error classification (II) -allan variance analysis method +imu test + calibration introduction

8000 word explanation of OBSA principle and application practice

Leetcode383 ransom letter

Alibaba Senior Software Testing Engineer recommends testers to learn -- Introduction to security testing

项目分析(哪些是it培训给不了)

How can anyone ask how MySQL archives data?

极化继电器

【无标题】
随机推荐
CMOS开关(二)_参数提取
[stonedb fault diagnosis] system resource bottleneck diagnosis
【OBS】P B 丢帧阈值 buffer_duration_usec
[Marine Science] climate indices data set
Lvs+kept highly available cluster
Implementation of arbitrary code execution based on.Net dynamic compilation technology
Starfish Os X MetaBell战略合作,元宇宙商业生态更进一步
Reed relay
Temperature relay
How to customize logging of.Net6.0
[C language] high precision addition, subtraction, multiplication and division template
CMOS switch (II)_ Parameter extraction
软件测试的就业前景到底怎么样?
7行代码让B站崩溃3小时
Understanding of L1 regularization and L2 regularization [easy to understand]
Yyds dry goods inventory # solve the real problem of famous enterprises: cycle number comparison
Is it safe to open an account online now? Then choose which securities to open a securities account
Regular expression exercise
直播软件app开发,uniapp scroll-view隐藏滚动条
【无标题】