yarn的使用

简介: yarn的使用

安装

npm i -g yarn

使用

常用命令

yarn add package // 安装依赖
yarn global add package // 全局安装依赖
yarn add package -D // 安装开发依赖
yarn remove package // 移除依赖

设置yarn国内源

yarn config set registry https://registry.npm.taobao.org/

设置yarn中node-sass的地址

yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g

yarn全部命令

Usage: yarn [command] [flags]
  Displays help information.
  Options:
    --cache-folder <path>               specify a custom folder that must be used to store the yarn cache
    --check-files                       install will verify file tree of packages for consistency
    --cwd <cwd>                         working directory to use (default: E:\workspace\asset-management)
    --disable-pnp                       disable the Plug'n'Play installation
    --emoji [bool]                      enable emoji in output (default: false)
    --enable-pnp, --pnp                 enable the Plug'n'Play installation
    --flat                              only allow one version of a package
    --focus                             Focus on a single workspace by installing remote copies of its sibling workspaces.
    --force                             install and build packages even if they were built before, overwrite lockfile
    --frozen-lockfile                   don't generate a lockfile and fail if an update is needed
    --global-folder <path>              specify a custom folder to store global packages     
    --har                               save HAR output of network traffic
    --https-proxy <host>
    --ignore-engines                    ignore engines check
    --ignore-optional                   ignore optional dependencies
    --ignore-platform                   ignore platform checks
    --ignore-scripts                    don't run lifecycle scripts
    --json                              format Yarn log messages as lines of JSON (see jsonlines.org)
    --link-duplicates                   create hardlinks to the repeated modules in node_modules
    --link-folder <path>                specify a custom folder to store global links        
    --modules-folder <path>             rather than installing modules into the node_modules 
folder relative to the cwd, output them here
    --mutex <type>[:specifier]          use a mutex to ensure only one yarn instance is executing
    --network-concurrency <number>      maximum number of concurrent network requests        
    --network-timeout <milliseconds>    TCP timeout for network requests
    --no-bin-links                      don't generate bin links when setting up packages    
    --no-default-rc                     prevent Yarn from automatically detecting yarnrc and 
npmrc files
    --no-lockfile                       don't read or generate a lockfile
    --non-interactive                   do not show interactive prompts
    --no-node-version-check             do not warn when using a potentially unsupported Node version
    --no-progress                       disable progress bar
    --offline                           trigger an error if any required dependencies are not available in local cache
    --otp <otpcode>                     one-time password for two factor authentication      
    --prefer-offline                    use network only if dependencies are not available in local cache
    --preferred-cache-folder <path>     specify a custom folder to store the yarn cache if possible
    --prod, --production [prod]
    --proxy <host>
    --pure-lockfile                     don't generate a lockfile
    --registry <url>                    override configuration registry
    -s, --silent                        skip Yarn console logs, other types of logs (script output) will be printed
    --scripts-prepend-node-path [bool]  prepend the node executable dir to the PATH in scripts
    --skip-integrity-check              run install without checking if node_modules is installed
    --strict-semver
    --update-checksums                  update package checksums from current repository     
    --use-yarnrc <path>                 specifies a yarnrc file that Yarn should use (.yarnrc only, not .npmrc) (default: )
    -v, --version                       output the version number
    --verbose                           output verbose messages on internal operations       
    -h, --help                          output usage information
  Commands:
    - access
    - add
    - audit
    - autoclean
    - bin
    - cache
    - check
    - config
    - create
    - exec
    - generate-lock-entry / generateLockEntry
    - global
    - help
    - import
    - info
    - init
    - install
    - licenses
    - link
    - list
    - login
    - logout
    - node
    - outdated
    - owner
    - pack
    - policies
    - publish
    - remove
    - run
    - tag
    - team
    - unlink
    - unplug
    - upgrade
    - upgrade-interactive / upgradeInteractive
    - version
    - versions
    - why
    - workspace
    - workspaces

相关文章
|
6月前
|
资源调度 Apache 流计算
Yarn命令详细介绍
Yarn命令详细介绍
165 2
|
缓存 资源调度 算法
yarn的使用
yarn的使用
104 0
|
资源调度
yarn出现 There are no scenarios ; must have at least one
yarn出现 There are no scenarios ; must have at least one
145 0
|
3月前
|
资源调度 分布式计算 Hadoop
什么是YARN?
【8月更文挑战第13天】
235 3
|
6月前
|
缓存 资源调度 前端开发
Yarn的安装和使用
【5月更文挑战第5天】**Yarn**是Facebook于2016年推出的快速、可靠的JavaScript包管理器,旨在解决npm的安装速度慢和依赖一致性问题。它通过确定性安装、并行下载和本地缓存提升开发体验。本文介绍了Yarn的基本概念、核心特性、安装步骤、常见问题及其解决方案,并提供了代码示例。Yarn支持工作空间管理、选择性版本安装、自动化脚本等进阶功能,与VSCode、Git和CI工具集成良好,且持续创新,如Yarn 2的PnP模式。掌握Yarn能有效提升前端开发效率和项目安全性。
336 2
|
5月前
|
资源调度 Linux iOS开发
yarn的安装和使用
yarn的安装和使用
355 0
|
6月前
|
资源调度 前端开发 JavaScript
Yarn安装与使用
Yarn安装与使用
87 0
|
6月前
|
资源调度 分布式计算 Hadoop
【Hadoop Yarn】Yarn 调度器分析
【4月更文挑战第7天】【Hadoop Yarn】Yarn 调度器分析
|
6月前
|
缓存 资源调度 JavaScript
Yarn的安装与使用
Yarn的安装与使用
103 1
|
缓存 资源调度
Yarn安装与配置
Yarn安装与配置 下载安装 配置 前言 今天在使用ruoyi-cloud-ant遇到了yarn install dependencies卡死的情况,之后发现yarn命令也不起作用了,经过了多次的安装和卸载yarn都没效果,最后发现一个类似的问题给我提了个醒,我试了一下解决了问题。记录一下yarn的安装、配置和遇到的问题。 下载安装 使用官方的installer.msi直接安装
528 0
Yarn安装与配置