サンプル集  >  ReactNative  >  yarnインストール
yarnインストール
2021/10/31

yarnをインストールします。

◆環境
OS Windows 10 Home 20H2 64bit OS x64 プロセッサ

yarn

yarn(ヤーン)はNode.jsの公式のnpmと互換性があるJavaScriptのパッケージマネージャーとのことです。

npmよりyarnの方が良いらしいです。

PowerShellでのchocolateyを使ったyarnのインストールコマンドです。

参考:Chocolateyインストール

choco install yarn -y

PowerShellを管理者で実行しコマンドを実行します。

PS C:\Windows\system32> choco install yarn -y
Chocolatey v0.11.3
Installing the following packages:
yarn
By installing, you accept licenses for the packages.
Progress: Downloading yarn 1.22.15... 100%

yarn v1.22.15 [Approved]
yarn package files install completed. Performing other installation s
teps.
Downloading yarn
  from 'https://yarnpkg.com/downloads/1.22.15/yarn-1.22.15.msi'
Progress: 100% - Completed download of C:\Users\xxxxx\AppData\Local\T
emp\chocolatey\yarn\1.22.15\yarn-1.22.15.msi (1.6 MB).
Download of yarn-1.22.15.msi (1.6 MB) completed.
Hashes match.
Installing yarn...
yarn has been installed.
#< CLIXML
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershel
l/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Mana
gement.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I
:
略 40~50行
:
0
Only an exit code of non-zero will fail the package by default. Set
 `--failonstderr` if you want error messages to also fail a script. S
ee
 `choco -h` for details.

  yarn may be able to be automatically uninstalled.
Environment Vars (like PATH) have changed. Close/reopen your shell to
 see the changes (or in powershell/cmd.exe just type `refreshenv`).

 The install of yarn was successful.
  Software installed as 'msi', install location is likely default.


Chocolatey installed 1/1 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.l
og).

PS C:\Windows\system32>

赤い文字の行が40~50行ぐらいどばっと出たので何かエラーが発生したのかと思いましたが「The install of yarn was successful.」と表示されているので正常にインストールされたのでしょうか。

環境変数が変更されたのでシェル(PowerShell or cmd)を閉じて再度開いてくださいと表示されているので、いったんPowerShellを閉じて開きなおします。

バージョンを確認します。

PS C:\Windows\system32> yarn --version
1.22.15
PS C:\Windows\system32>


2025/11/22 追記

yarnのバージョンは1.22.22になっていました。

yarn --version
1.22.22

▲ PageTop  ■ Home


Copyright (C) 2021 - 2025 ymlib.com