当前位置:网站首页>Common instructions of NPM and yarn
Common instructions of NPM and yarn
2022-07-21 05:53:00 【linjun20】
Initialize a new project
yarn init --yes # Abbreviation -y
npm init --yes # Abbreviation -y
Add dependency
yarn add <package...> [--dev/-D] // No -D Default production environment
yarn add [package]@[version] # With version
npm install XXX --save It can be abbreviated as npm i XXX -S --------> Installation project dependency
npm install XXX --save-dev It can be abbreviated as npm i XXX -D ------> Installation development depends on
Install global dependencies
yarn global add [package]
npm install [package] -g
Remove dependency
yarn remove <packageName>
npm uninstall <packageName> -S
Remove dependencies globally
yarn global remove <packageName>
npm uninstall -g <packageName>
Upgrade dependency
yarn upgrade # Upgrade all dependencies , Not recorded in package.json in
npm update # npm Can pass ‘--save|--save-dev’ Specify which type of dependency to upgrade
yarn upgrade webpack # Upgrade the specified package
npm update webpack --save-dev #
npm yarn upgrade --latest # Ignore version rules , Upgrade to the latest version , And update package.json
Run script
yarn run
npm run
List all global dependencies
yarn global list --depth=0 # Limit the depth of dependency
npm list -g --depth=0
Clear cache
yarn cache clean
npm cache clean --force
npm and yarn Convert Taobao source and official source
npm config set registry http://registry.npm.taobao.org/
npm config set registry https://registry.npmjs.org/
yarn config set registry http://registry.npm.taobao.org/
yarn config set registry https://registry.npmjs.org/
npm Setting agent
npm config set proxy http://127.0.0.1:8080
npm config set https-proxy http://127.0.0.1:8080
yarn config set proxy http://127.0.0.1:8080
yarn config set https-proxy http://127.0.0.1:8080
npm Delete agent
npm config delete proxy
npm config delete https-proxy
yarn config delete proxy
yarn config delete https-proxy
Set offline image storage :
yarn config set yarn-offline-mirror [MIRROR_DIRECTORY_PATH]
yarn config set yarn-offline-mirror-pruning true
The first configuration is the location of the offline image cache folder , Used to store downloaded TAR package . The second configuration is to help clean up all unlinked dependencies ( You can leave it blank ).
This setting will create ~/.yarnrc
, If it is not set globally , Instead, only the current project needs to be set , You need to move the file to the current project directory :
The method of testing offline status is as follows ( You need to turn off the wired or wireless network connection ):
yarn cache clean
yarn install -offline
边栏推荐
- Summer summary (I)
- 7 hyperLogLog
- Operation methods and skills of CAD perfect transformation to ArcGIS
- 什麼是棧?
- After working for two months in the summer vacation, I understood three routing schemes of keepalived high availability
- [postgraduate entrance examination vocabulary training camp] day 9 - vital, dynamity, previous, pray, transit, virile, invent
- 【码蹄集新手村600题】整除幸运数
- C#入门系列(二十五) -- 接口
- 数字孪生落地设计桥梁可视化解决方案
- Cloud Foundry 开发 4.cf 命令
猜你喜欢
[MySQL] current date minus one day field year month day -1 day
Leetcode-152- maximum array of products
gis设备在国土资源管理中有何作用?
Leetcode-24-exchange nodes in linked list in pairs
Knowledge points of MySQL (10)
网络层协议 ——— IP协议
发电机组工作安排问题代码
Qu'est - ce qu'une pile?
Application of linked list
[code hoof set novice village question 600] how to change the binary value at the even position of all binaries of a decimal integer to 0
随机推荐
永久挂载镜像步骤
linux服务器PostgreSQL数据库自动备份
Reading Ming Dynasty 1566
Niuke-top101-bm33
(第二章一一栈与队列)第二节 栈的链式存储
string类
JVM heap memory parsing
Redis未授权访问漏洞复现(www.hetianlab.com)
数字孪生落地设计桥梁可视化解决方案
Guys, do PostgreSQL CDC and PostgreSQL have to configure logical replication? Currently deployed
Summer summary (I)
「接口测试入门课」打卡学习 day09:微服务接口:怎么用Mock解决混乱的调用关系
php 匹配正则 取出url
Theoretical basis of multithreading
IT7259Q-13、IT7259EX-24特征 可穿戴设备
【mysql】当前日期减一天 字段年月日-1天
(Chapter 2 - stack and queue) chain storage of the second section stack
[postgraduate entrance examination vocabulary training camp] day 9 - vital, dynamity, previous, pray, transit, virile, invent
bgp简介
低代码开发平台搭建会展服务管理系统案例分析