当前位置:网站首页>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
边栏推荐
- More than 100 lines should be split into functions
- 刚培训完的中级测试工程师如何快速度过试用期
- Live broadcast software app development, uniapp scroll view hidden scroll bar
- Wireshark filter rule notes, with software
- SQL injection less26a (Boolean blind injection)
- cocos:ccpDistance函数的简单运用以及实现眼球随着手指在眼眶中转动的功能
- [C language] high precision addition, subtraction, multiplication and division template
- Is it safe to open an account online now? Then choose which securities to open a securities account
- First knowledge of esp8266 (I) -- access point and wireless terminal mode
- Monitor the running of server jar and restart script
猜你喜欢

How to deal with high concurrency deadlock?

Apachespark command execution (cve-2022-33891) vulnerability recurrence

vs2019 release模式调试:此表达式有副作用,将不予计算。

温度继电器

【海洋科学】海洋气候指数【Climate Indices】数据集

Principle and application of CMOS transmission gate

极化继电器

软件测试的就业前景到底怎么样?

leetcode15--三数之和

8000 word explanation of OBSA principle and application practice
随机推荐
Enumeration and annotation
Live video source code, uni app to achieve advertising scroll bar
leetcode15--三数之和
Leetcode-39-total number of combinations
Leetcode-155-minimum stack
Interview question: what are the functions of fail safe mechanism and fail fast mechanism
day 1 - day 4
Leetcode-538- convert binary search tree to cumulative tree
Leetcode 301. delete invalid parentheses
【二叉树】统计二叉树中好节点的数目
How to deal with high concurrency deadlock?
Drawing three coordinate (axis) diagram with MATLAB
Project analysis (what is it training that can't be given)
EC code introduction
What is eplato cast by Plato farm on elephant swap? Why is there a high premium?
8000 word explanation of OBSA principle and application practice
【无标题】
Encapsulate an array into a class
项目分析(从技术到项目、产品)
7行代码让B站崩溃3小时