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

相关文章
|
2月前
|
资源调度 Apache 流计算
Yarn命令详细介绍
Yarn命令详细介绍
92 2
|
8月前
|
资源调度
yarn出现 There are no scenarios ; must have at least one
yarn出现 There are no scenarios ; must have at least one
|
8月前
|
缓存 资源调度 算法
yarn的使用
yarn的使用
|
28天前
|
资源调度 Linux iOS开发
yarn的安装和使用
yarn的安装和使用
28 0
|
2月前
|
缓存 资源调度 前端开发
Yarn的安装和使用
【5月更文挑战第5天】**Yarn**是Facebook于2016年推出的快速、可靠的JavaScript包管理器,旨在解决npm的安装速度慢和依赖一致性问题。它通过确定性安装、并行下载和本地缓存提升开发体验。本文介绍了Yarn的基本概念、核心特性、安装步骤、常见问题及其解决方案,并提供了代码示例。Yarn支持工作空间管理、选择性版本安装、自动化脚本等进阶功能,与VSCode、Git和CI工具集成良好,且持续创新,如Yarn 2的PnP模式。掌握Yarn能有效提升前端开发效率和项目安全性。
91 2
|
2月前
|
资源调度 前端开发 JavaScript
Yarn安装与使用
Yarn安装与使用
31 0
|
2月前
|
缓存 资源调度 前端开发
yarn 的安装和使用
yarn 的安装和使用
|
2月前
|
缓存 资源调度 JavaScript
Yarn的安装与使用
Yarn的安装与使用
|
资源调度 分布式计算 监控
|
缓存 资源调度 安全
yarn 学习总结
yarn 是由Facebook、Google、Exponent 和 Tilde 联合推出了一个新的 JS 包管理工具,它仍然使用 npm 的registry,不过提供了全新 CLI 来对包进行管理