当前位置:网站首页>NPM, YRAN, NPX的差异与关系
NPM, YRAN, NPX的差异与关系
2022-07-28 05:18:00 【SheepOnTheCloud】
| 区别 | npm | yran | |
| 安装方式 | 需等待上一个安装任务结束才会执行下一个 | 同时执行多个安装任务 | |
| 离线安装 | 从网络上重新下载 | 如果已经安装过包,会优先从中获取 | |
| 版本 | 默认从网络下载最新的最稳定的,可以通过命令实现版本锁定 | 默认有一个 yarn.lock 文件锁定版本,保证环境统一 | |
| 安装输出 | 输出信息冗余 | 输出的信息较少 | |
| 下载安装 | 在 node.js 官网里推荐选择 LTS (长期支持)版本 | npm install -g yarn | |
| 查看版本 | 命令行用node -v 查看node的安装版本。顺便 npm -v 查看npm的版本号。 | yarn --version |
总结
1,npm 下载速度慢,即使重新install是速度依旧慢,yarn要快
2,npm的同一个项目安装的包无法保持一致性,yarn版本锁定
3,npm下载多个包时单个包的下载出错会抛出并继续下载下一个包,yran直观的打印安装信息
npx?
npx是npm的高级版本,具有更强大的功能
- 在项目中直接运行指令,直接运行node_modules中的某个指令,不需要输入文件路径
node-modules/.bin/babel.js --version npx babel --version - 避免全局安装模块:npx 临时安装一个模块,使用过后删除这个模块(下面的两个模块不需要全局安装)
npx babel my-react-app npx [email protected] main.js -o ./dist/main.js - 使用不同版本的命令,使用本地或者下载的命令
npx --no-install http-server # 必须使用本地 http-server(本地没有就报错) npx --ignore-existing create-react-app my-react-app # 忽略本地安装的包,直接使用下载的包 npx [email protected] -v #使用特定版本的包的命令参数
- -p 下载某个模块后,运行命令(命令必须在下载后才行,类似于通道符)
npx -p [email protected] node -v npx -p A -p B [command]github
- 可以执行仓库中的代码,远程代码必须是一个模块,即必须包含
package.json和入口脚本npx github:piuccio/cowsay hello
边栏推荐
- 2021csdn blog star selection, mutual investment
- repackag failed: Unable to find main class
- Redis' bloom filter
- About localdatetime in swagger
- When SQL queries the list, the data is inconsistent twice, and limit is automatically added
- Low illumination image data set
- pytorch安装----CPU版的
- Openjudge: patient queuing
- Response<T>类
- 冶金物理化学复习 --- 液 - 液相反应动力学
猜你喜欢

论文模型主图范例

冶金物理化学复习 --- 气-液相反应动力学

Digital twin technology creates visual application of smart mine

ByteBuffer. Position throws exception illegalargumentexception

顺序表oj题目

Centos7 install MySQL 5.7

正则表达式

How Visio accurately controls the size, position and angle of graphics

蒸馏模型图

Using Navicat or PLSQL to export CSV format, more than 15 digits will become 000 (e+19) later
随机推荐
GD32F407 移植FreeRTOS+Lwip
Mutual conversion between latex and word
冶金物理化学复习 --- 化学反应动力学基础
openjudge:过滤多余的空格
ResNet结构对比
BigDecimal rounds and retains two decimal places
标准C语言总结1
正则表达式
框架一步一步方便使用的流程
Docker deploy mysql5.7.35
VMware Workstation is incompatible with device/credential guard. Disable device/credential guard
docker 部署 mysql5.7.35
Openjudge: count the number of numeric characters
Arrangement of main drawings of the latest 54 papers of eccv22
The essence of dynamic convolution
Localdatetime removes T, and jsonfield is invalid
When using \hl for highlighting, latex always reports an error when encountering a reference, showing that there are fewer or more parentheses
蒸馏模型图
openjudge:病人排队
C语言回顾(指针篇)