@fredlackey/devutils 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/package.json +1 -1
- package/src/commands/install.js +374 -36
- package/src/installs/adobe-creative-cloud.js +527 -25
- package/src/installs/adobe-creative-cloud.md +605 -0
- package/src/installs/appcleaner.js +303 -26
- package/src/installs/appcleaner.md +699 -0
- package/src/installs/apt-transport-https.js +390 -0
- package/src/installs/apt-transport-https.md +678 -0
- package/src/installs/atomicparsley.js +624 -26
- package/src/installs/atomicparsley.md +795 -0
- package/src/installs/aws-cli.js +779 -26
- package/src/installs/aws-cli.md +727 -0
- package/src/installs/balena-etcher.js +688 -26
- package/src/installs/balena-etcher.md +761 -0
- package/src/installs/bambu-studio.js +912 -26
- package/src/installs/bambu-studio.md +780 -0
- package/src/installs/bash-completion.js +554 -23
- package/src/installs/bash-completion.md +833 -0
- package/src/installs/bash.js +399 -26
- package/src/installs/bash.md +993 -0
- package/src/installs/beyond-compare.js +585 -26
- package/src/installs/beyond-compare.md +813 -0
- package/src/installs/build-essential.js +511 -26
- package/src/installs/build-essential.md +977 -0
- package/src/installs/ca-certificates.js +618 -0
- package/src/installs/ca-certificates.md +937 -0
- package/src/installs/caffeine.js +490 -26
- package/src/installs/caffeine.md +839 -0
- package/src/installs/camtasia.js +577 -25
- package/src/installs/camtasia.md +762 -0
- package/src/installs/chatgpt.js +458 -26
- package/src/installs/chatgpt.md +814 -0
- package/src/installs/chocolatey.js +447 -0
- package/src/installs/chocolatey.md +661 -0
- package/src/installs/chrome-canary.js +472 -26
- package/src/installs/chrome-canary.md +641 -0
- package/src/installs/chromium.js +645 -26
- package/src/installs/chromium.md +838 -0
- package/src/installs/claude-code.js +558 -26
- package/src/installs/claude-code.md +1173 -0
- package/src/installs/curl.js +361 -26
- package/src/installs/curl.md +714 -0
- package/src/installs/cursor.js +561 -26
- package/src/installs/cursor.md +970 -0
- package/src/installs/dbschema.js +674 -26
- package/src/installs/dbschema.md +925 -0
- package/src/installs/dependencies.md +435 -0
- package/src/installs/development-tools.js +600 -0
- package/src/installs/development-tools.md +977 -0
- package/src/installs/docker.js +1010 -25
- package/src/installs/docker.md +1109 -0
- package/src/installs/drawio.js +1001 -26
- package/src/installs/drawio.md +795 -0
- package/src/installs/elmedia-player.js +328 -25
- package/src/installs/elmedia-player.md +556 -0
- package/src/installs/ffmpeg.js +870 -25
- package/src/installs/ffmpeg.md +852 -0
- package/src/installs/file.js +464 -0
- package/src/installs/file.md +987 -0
- package/src/installs/gemini-cli.js +793 -26
- package/src/installs/gemini-cli.md +1153 -0
- package/src/installs/git.js +382 -26
- package/src/installs/git.md +907 -0
- package/src/installs/gitego.js +931 -26
- package/src/installs/gitego.md +1172 -0
- package/src/installs/go.js +913 -26
- package/src/installs/go.md +958 -0
- package/src/installs/google-chrome.js +801 -25
- package/src/installs/google-chrome.md +862 -0
- package/src/installs/gpg.js +412 -73
- package/src/installs/gpg.md +1056 -0
- package/src/installs/homebrew.js +1015 -26
- package/src/installs/homebrew.md +988 -0
- package/src/installs/imageoptim.js +950 -26
- package/src/installs/imageoptim.md +1119 -0
- package/src/installs/installers.json +2297 -0
- package/src/installs/jq.js +382 -26
- package/src/installs/jq.md +809 -0
- package/src/installs/keyboard-maestro.js +701 -26
- package/src/installs/keyboard-maestro.md +825 -0
- package/src/installs/latex.js +771 -26
- package/src/installs/latex.md +1095 -0
- package/src/installs/lftp.js +338 -26
- package/src/installs/lftp.md +907 -0
- package/src/installs/lsb-release.js +346 -0
- package/src/installs/lsb-release.md +814 -0
- package/src/installs/messenger.js +829 -26
- package/src/installs/messenger.md +900 -0
- package/src/installs/microsoft-office.js +550 -26
- package/src/installs/microsoft-office.md +760 -0
- package/src/installs/microsoft-teams.js +782 -25
- package/src/installs/microsoft-teams.md +886 -0
- package/src/installs/node.js +886 -26
- package/src/installs/node.md +1153 -0
- package/src/installs/nordpass.js +698 -26
- package/src/installs/nordpass.md +921 -0
- package/src/installs/nvm.js +977 -26
- package/src/installs/nvm.md +1057 -0
- package/src/installs/openssh.js +734 -64
- package/src/installs/openssh.md +1056 -0
- package/src/installs/pandoc.js +644 -26
- package/src/installs/pandoc.md +1036 -0
- package/src/installs/pinentry.js +492 -26
- package/src/installs/pinentry.md +1142 -0
- package/src/installs/pngyu.js +851 -26
- package/src/installs/pngyu.md +896 -0
- package/src/installs/postman.js +781 -26
- package/src/installs/postman.md +940 -0
- package/src/installs/procps.js +425 -0
- package/src/installs/procps.md +851 -0
- package/src/installs/safari-tech-preview.js +355 -25
- package/src/installs/safari-tech-preview.md +533 -0
- package/src/installs/sfnt2woff.js +640 -26
- package/src/installs/sfnt2woff.md +795 -0
- package/src/installs/shellcheck.js +463 -26
- package/src/installs/shellcheck.md +1005 -0
- package/src/installs/slack.js +722 -25
- package/src/installs/slack.md +865 -0
- package/src/installs/snagit.js +566 -25
- package/src/installs/snagit.md +844 -0
- package/src/installs/software-properties-common.js +372 -0
- package/src/installs/software-properties-common.md +805 -0
- package/src/installs/spotify.js +858 -25
- package/src/installs/spotify.md +901 -0
- package/src/installs/studio-3t.js +803 -26
- package/src/installs/studio-3t.md +918 -0
- package/src/installs/sublime-text.js +780 -25
- package/src/installs/sublime-text.md +914 -0
- package/src/installs/superwhisper.js +687 -25
- package/src/installs/superwhisper.md +630 -0
- package/src/installs/tailscale.js +727 -26
- package/src/installs/tailscale.md +1100 -0
- package/src/installs/tar.js +389 -0
- package/src/installs/tar.md +946 -0
- package/src/installs/termius.js +780 -26
- package/src/installs/termius.md +844 -0
- package/src/installs/terraform.js +761 -26
- package/src/installs/terraform.md +899 -0
- package/src/installs/tidal.js +752 -25
- package/src/installs/tidal.md +864 -0
- package/src/installs/tmux.js +328 -26
- package/src/installs/tmux.md +1030 -0
- package/src/installs/tree.js +393 -26
- package/src/installs/tree.md +833 -0
- package/src/installs/unzip.js +460 -0
- package/src/installs/unzip.md +879 -0
- package/src/installs/vim.js +403 -26
- package/src/installs/vim.md +1040 -0
- package/src/installs/vlc.js +803 -26
- package/src/installs/vlc.md +927 -0
- package/src/installs/vscode.js +825 -26
- package/src/installs/vscode.md +1002 -0
- package/src/installs/wget.js +415 -0
- package/src/installs/wget.md +791 -0
- package/src/installs/whatsapp.js +710 -25
- package/src/installs/whatsapp.md +854 -0
- package/src/installs/winpty.js +352 -0
- package/src/installs/winpty.md +620 -0
- package/src/installs/woff2.js +535 -26
- package/src/installs/woff2.md +977 -0
- package/src/installs/wsl.js +572 -0
- package/src/installs/wsl.md +699 -0
- package/src/installs/xcode-clt.js +520 -0
- package/src/installs/xcode-clt.md +351 -0
- package/src/installs/xcode.js +542 -26
- package/src/installs/xcode.md +573 -0
- package/src/installs/yarn.js +806 -26
- package/src/installs/yarn.md +1074 -0
- package/src/installs/yq.js +636 -26
- package/src/installs/yq.md +944 -0
- package/src/installs/yt-dlp.js +683 -26
- package/src/installs/yt-dlp.md +946 -0
- package/src/installs/yum-utils.js +297 -0
- package/src/installs/yum-utils.md +648 -0
- package/src/installs/zoom.js +740 -25
- package/src/installs/zoom.md +884 -0
- package/src/scripts/README.md +567 -45
- package/src/scripts/STATUS.md +208 -0
- package/src/scripts/afk.js +395 -7
- package/src/scripts/backup-all.js +731 -9
- package/src/scripts/backup-source.js +711 -8
- package/src/scripts/brewd.js +373 -7
- package/src/scripts/brewi.js +505 -9
- package/src/scripts/brewr.js +512 -9
- package/src/scripts/brews.js +462 -9
- package/src/scripts/brewu.js +488 -7
- package/src/scripts/c.js +185 -7
- package/src/scripts/ccurl.js +325 -8
- package/src/scripts/certbot-crontab-init.js +488 -8
- package/src/scripts/certbot-init.js +641 -9
- package/src/scripts/ch.js +339 -7
- package/src/scripts/claude-danger.js +253 -8
- package/src/scripts/clean-dev.js +419 -8
- package/src/scripts/clear-dns-cache.js +525 -7
- package/src/scripts/clone.js +417 -7
- package/src/scripts/code-all.js +420 -7
- package/src/scripts/count-files.js +195 -8
- package/src/scripts/count-folders.js +195 -8
- package/src/scripts/count.js +248 -8
- package/src/scripts/d.js +203 -7
- package/src/scripts/datauri.js +373 -8
- package/src/scripts/delete-files.js +363 -7
- package/src/scripts/docker-clean.js +410 -8
- package/src/scripts/dp.js +426 -7
- package/src/scripts/e.js +375 -9
- package/src/scripts/empty-trash.js +497 -7
- package/src/scripts/evm.js +428 -9
- package/src/scripts/fetch-github-repos.js +441 -10
- package/src/scripts/get-channel.js +329 -8
- package/src/scripts/get-course.js +384 -11
- package/src/scripts/get-dependencies.js +290 -9
- package/src/scripts/get-folder.js +783 -10
- package/src/scripts/get-tunes.js +411 -10
- package/src/scripts/get-video.js +352 -9
- package/src/scripts/git-backup.js +561 -9
- package/src/scripts/git-clone.js +477 -9
- package/src/scripts/git-pup.js +303 -7
- package/src/scripts/git-push.js +380 -8
- package/src/scripts/h.js +607 -9
- package/src/scripts/hide-desktop-icons.js +483 -7
- package/src/scripts/hide-hidden-files.js +522 -7
- package/src/scripts/install-dependencies-from.js +440 -9
- package/src/scripts/ips.js +647 -10
- package/src/scripts/iso.js +354 -8
- package/src/scripts/killni.js +561 -7
- package/src/scripts/ll.js +451 -8
- package/src/scripts/local-ip.js +310 -8
- package/src/scripts/m.js +508 -8
- package/src/scripts/map.js +293 -8
- package/src/scripts/mkd.js +287 -7
- package/src/scripts/ncu-update-all.js +441 -8
- package/src/scripts/nginx-init.js +702 -12
- package/src/scripts/npmi.js +366 -7
- package/src/scripts/o.js +495 -8
- package/src/scripts/org-by-date.js +321 -7
- package/src/scripts/p.js +208 -7
- package/src/scripts/packages.js +313 -8
- package/src/scripts/path.js +209 -7
- package/src/scripts/ports.js +582 -8
- package/src/scripts/q.js +290 -8
- package/src/scripts/refresh-files.js +378 -10
- package/src/scripts/remove-smaller-files.js +500 -8
- package/src/scripts/rename-files-with-date.js +517 -9
- package/src/scripts/resize-image.js +523 -9
- package/src/scripts/rm-safe.js +653 -8
- package/src/scripts/s.js +525 -9
- package/src/scripts/set-git-public.js +349 -7
- package/src/scripts/show-desktop-icons.js +459 -7
- package/src/scripts/show-hidden-files.js +456 -7
- package/src/scripts/tpa.js +265 -8
- package/src/scripts/tpo.js +264 -7
- package/src/scripts/u.js +489 -7
- package/src/scripts/vpush.js +422 -8
- package/src/scripts/y.js +267 -7
- package/src/utils/common/os.js +94 -2
- package/src/utils/ubuntu/apt.js +13 -7
- package/src/utils/windows/choco.js +82 -26
- package/src/utils/windows/winget.js +89 -27
|
@@ -0,0 +1,1074 @@
|
|
|
1
|
+
# Installing Yarn
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Yarn is a fast, reliable, and secure JavaScript package manager developed by Facebook (now Meta) as an alternative to npm. It addresses key pain points in JavaScript dependency management by offering deterministic installations, offline caching, and parallel downloads. Yarn provides two major version lines:
|
|
6
|
+
|
|
7
|
+
- **Yarn Classic (1.x)**: The original, stable version still widely used in production environments. This is what system package managers (Homebrew, APT, Chocolatey) install by default.
|
|
8
|
+
- **Yarn Modern (Berry, 2.x+)**: A complete rewrite with advanced features like Plug'n'Play (zero `node_modules`), workspaces, and plugins. Managed per-project via Corepack or `yarn set version`.
|
|
9
|
+
|
|
10
|
+
Key capabilities of Yarn:
|
|
11
|
+
|
|
12
|
+
- Deterministic dependency resolution through lockfiles
|
|
13
|
+
- Parallel package downloads for faster installations
|
|
14
|
+
- Offline mode using cached packages
|
|
15
|
+
- Workspaces for monorepo management
|
|
16
|
+
- Security-focused design with integrity checks
|
|
17
|
+
|
|
18
|
+
This guide documents Yarn Classic (1.x) installation for system-wide availability across all platforms supported by DevUtils CLI. For projects requiring Yarn Modern (2.x+), use Corepack after installing Node.js.
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
|
|
22
|
+
Before installing Yarn on any platform, ensure:
|
|
23
|
+
|
|
24
|
+
1. **Node.js installed** - Yarn requires Node.js 18 or later (LTS recommended)
|
|
25
|
+
2. **Internet connectivity** - Required to download Yarn packages
|
|
26
|
+
3. **Administrative privileges** - Required for system-wide installation
|
|
27
|
+
4. **Terminal access** - Required to run installation commands
|
|
28
|
+
|
|
29
|
+
**Version Strategy**: This guide installs Yarn Classic (1.x) for maximum compatibility. If your project requires Yarn Modern (2.x, 3.x, or 4.x), install Node.js first, then use Corepack:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
corepack enable
|
|
33
|
+
yarn init -2
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Dependencies
|
|
37
|
+
|
|
38
|
+
### macOS (Homebrew)
|
|
39
|
+
- **Required:**
|
|
40
|
+
- Homebrew - Install via `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"` or `dev install homebrew`
|
|
41
|
+
- **Optional:** None
|
|
42
|
+
- **Auto-installed:**
|
|
43
|
+
- Node.js - Homebrew automatically installs Node.js as a dependency if not present
|
|
44
|
+
|
|
45
|
+
### Ubuntu (APT/Snap)
|
|
46
|
+
- **Required:**
|
|
47
|
+
- `curl` - Install via `sudo apt-get install -y curl`
|
|
48
|
+
- `gnupg` - Install via `sudo apt-get install -y gnupg`
|
|
49
|
+
- `ca-certificates` - Install via `sudo apt-get install -y ca-certificates`
|
|
50
|
+
- **Optional:**
|
|
51
|
+
- Node.js - Install via `dev install node` or NodeSource repository (recommended but not enforced by installer)
|
|
52
|
+
- **Auto-installed:**
|
|
53
|
+
- None (all dependencies must be explicitly installed)
|
|
54
|
+
- **Note:** The conflicting `cmdtest` package is automatically removed if present
|
|
55
|
+
|
|
56
|
+
### Raspberry Pi OS (APT/Snap)
|
|
57
|
+
- **Required:**
|
|
58
|
+
- `curl` - Install via `sudo apt-get install -y curl`
|
|
59
|
+
- `gnupg` - Install via `sudo apt-get install -y gnupg`
|
|
60
|
+
- `ca-certificates` - Install via `sudo apt-get install -y ca-certificates`
|
|
61
|
+
- **Optional:**
|
|
62
|
+
- Node.js - Install via `dev install node` or NodeSource repository (recommended but not enforced by installer)
|
|
63
|
+
- **Auto-installed:**
|
|
64
|
+
- None (all dependencies must be explicitly installed)
|
|
65
|
+
- **Note:** The conflicting `cmdtest` package is automatically removed if present
|
|
66
|
+
|
|
67
|
+
### Amazon Linux (DNF/YUM)
|
|
68
|
+
- **Required:**
|
|
69
|
+
- `curl` - Install via `sudo dnf install -y curl` (AL2023) or `sudo yum install -y curl` (AL2)
|
|
70
|
+
- DNF or YUM package manager - Pre-installed on Amazon Linux, RHEL, Fedora, CentOS
|
|
71
|
+
- **Optional:**
|
|
72
|
+
- Node.js - Install via `dev install node` (recommended but not enforced by installer)
|
|
73
|
+
- **Auto-installed:**
|
|
74
|
+
- None (all dependencies must be explicitly installed)
|
|
75
|
+
|
|
76
|
+
### Windows (Chocolatey/winget)
|
|
77
|
+
- **Required:**
|
|
78
|
+
- Chocolatey - Install via PowerShell: `Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))`
|
|
79
|
+
- Administrator privileges - Required for Chocolatey package installation
|
|
80
|
+
- **Optional:**
|
|
81
|
+
- Node.js - Install via `choco install nodejs-lts -y` (recommended but Chocolatey can install it automatically as a dependency)
|
|
82
|
+
- **Auto-installed:**
|
|
83
|
+
- Node.js - Chocolatey can automatically install Node.js as a dependency if missing
|
|
84
|
+
|
|
85
|
+
### Git Bash (Manual/Portable)
|
|
86
|
+
- **Required:**
|
|
87
|
+
- Git Bash (Git for Windows) - Download from https://git-scm.com/download/win
|
|
88
|
+
- Chocolatey on Windows host - Install via PowerShell (see Windows section above)
|
|
89
|
+
- Administrator privileges - Required for Chocolatey operations via PowerShell interop
|
|
90
|
+
- **Optional:**
|
|
91
|
+
- `winpty` - Install via `pacman -S winpty` in Git Bash (for interactive Yarn commands, usually pre-installed with Git for Windows)
|
|
92
|
+
- Node.js - Install via `choco install nodejs-lts -y` (recommended)
|
|
93
|
+
- **Auto-installed:**
|
|
94
|
+
- Node.js - Chocolatey can automatically install Node.js as a dependency if missing
|
|
95
|
+
- **Note:** Yarn is installed on the Windows host and becomes available in Git Bash through PATH inheritance
|
|
96
|
+
|
|
97
|
+
## Platform-Specific Installation
|
|
98
|
+
|
|
99
|
+
### macOS (Homebrew)
|
|
100
|
+
|
|
101
|
+
#### Prerequisites
|
|
102
|
+
|
|
103
|
+
- macOS 12 (Monterey) or later (macOS 14 Sonoma or later recommended)
|
|
104
|
+
- Homebrew package manager installed
|
|
105
|
+
- Node.js installed (Homebrew will install it as a dependency if missing)
|
|
106
|
+
- Apple Silicon (M1/M2/M3/M4) or Intel processor
|
|
107
|
+
|
|
108
|
+
If Homebrew is not installed, install it first:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
If Node.js is not installed, install it first:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
brew install --quiet node
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### Installation Steps
|
|
121
|
+
|
|
122
|
+
Run the following command to install Yarn:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
brew install --quiet yarn
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The `--quiet` flag suppresses non-essential output, making the installation suitable for automation and scripts. This installs Yarn Classic (1.22.x), which is the stable version provided by Homebrew.
|
|
129
|
+
|
|
130
|
+
**Note**: The Homebrew `yarn` formula conflicts with `corepack` and `hadoop` packages. If you have either installed, you must uninstall them first or use npm to install Yarn instead.
|
|
131
|
+
|
|
132
|
+
#### Verification
|
|
133
|
+
|
|
134
|
+
Confirm the installation succeeded:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
yarn --version
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Expected output (version numbers may vary):
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
1.22.22
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Verify the Homebrew version is being used:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
which yarn
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Expected output for Apple Silicon Macs:
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
/opt/homebrew/bin/yarn
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Expected output for Intel Macs:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
/usr/local/bin/yarn
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Test Yarn works by checking its configuration:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
yarn config list
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### Troubleshooting
|
|
171
|
+
|
|
172
|
+
**Problem**: `brew: command not found`
|
|
173
|
+
|
|
174
|
+
**Solution**: Homebrew is not installed or not in PATH. Install Homebrew first:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Problem**: Conflict with corepack
|
|
181
|
+
|
|
182
|
+
**Solution**: If you see a conflict error, you must choose between Homebrew's Yarn or Corepack-managed Yarn:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Option: Remove Homebrew yarn and use corepack
|
|
186
|
+
brew uninstall yarn
|
|
187
|
+
corepack enable
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Problem**: `yarn --version` shows unexpected version or command not found
|
|
191
|
+
|
|
192
|
+
**Solution**: Ensure Homebrew's bin directory is in your PATH before other directories:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc
|
|
196
|
+
source ~/.zshrc
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
For Intel Macs, use `/usr/local/bin` instead of `/opt/homebrew/bin`.
|
|
200
|
+
|
|
201
|
+
**Problem**: Yarn cannot find Node.js
|
|
202
|
+
|
|
203
|
+
**Solution**: Ensure Node.js is installed via Homebrew:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
brew install --quiet node
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
### Ubuntu/Debian (APT)
|
|
212
|
+
|
|
213
|
+
#### Prerequisites
|
|
214
|
+
|
|
215
|
+
- Ubuntu 20.04 LTS or later, or Debian 11 (Bullseye) or later (64-bit)
|
|
216
|
+
- sudo privileges
|
|
217
|
+
- Node.js installed (install via NodeSource repository for latest versions)
|
|
218
|
+
- curl and gnupg installed
|
|
219
|
+
|
|
220
|
+
**Important**: Some older Ubuntu versions ship with a package called `cmdtest` that provides a different `yarn` command. Remove it first to avoid conflicts.
|
|
221
|
+
|
|
222
|
+
#### Installation Steps
|
|
223
|
+
|
|
224
|
+
**Step 1: Remove conflicting packages**
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get remove -y cmdtest 2>/dev/null || true
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Step 2: Install prerequisites**
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
|
234
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y curl gnupg ca-certificates
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**Step 3: Add the Yarn GPG key and repository**
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /etc/apt/keyrings/yarn-archive-keyring.gpg > /dev/null
|
|
241
|
+
echo "deb [signed-by=/etc/apt/keyrings/yarn-archive-keyring.gpg] https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list > /dev/null
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**Step 4: Install Yarn**
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
|
248
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y yarn
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
The `DEBIAN_FRONTEND=noninteractive` environment variable ensures no interactive prompts appear during installation, making this suitable for scripts and automation.
|
|
252
|
+
|
|
253
|
+
**Note for nvm users**: If you manage Node.js with nvm, install Yarn without the Node.js dependency:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends yarn
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
#### Verification
|
|
260
|
+
|
|
261
|
+
Confirm the installation succeeded:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
yarn --version
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Expected output (version numbers may vary):
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
1.22.22
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Verify the installation location:
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
which yarn
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Expected output:
|
|
280
|
+
|
|
281
|
+
```
|
|
282
|
+
/usr/bin/yarn
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Test Yarn works by checking its configuration:
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
yarn config list
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
#### Troubleshooting
|
|
292
|
+
|
|
293
|
+
**Problem**: `E: Unable to locate package yarn`
|
|
294
|
+
|
|
295
|
+
**Solution**: The Yarn repository was not added correctly. Re-run the repository setup:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /etc/apt/keyrings/yarn-archive-keyring.gpg > /dev/null
|
|
299
|
+
echo "deb [signed-by=/etc/apt/keyrings/yarn-archive-keyring.gpg] https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list > /dev/null
|
|
300
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**Problem**: Running `yarn` opens a different program (cmdtest)
|
|
304
|
+
|
|
305
|
+
**Solution**: The `cmdtest` package provides a conflicting `yarn` command. Remove it:
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get remove -y cmdtest
|
|
309
|
+
hash -r
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
**Problem**: GPG key errors during repository setup
|
|
313
|
+
|
|
314
|
+
**Solution**: Ensure gnupg and ca-certificates are installed:
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y gnupg ca-certificates
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**Problem**: Yarn cannot find Node.js
|
|
321
|
+
|
|
322
|
+
**Solution**: Install Node.js via the NodeSource repository:
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
|
|
326
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
### Raspberry Pi OS (APT)
|
|
332
|
+
|
|
333
|
+
#### Prerequisites
|
|
334
|
+
|
|
335
|
+
- Raspberry Pi OS (Bookworm or Bullseye recommended)
|
|
336
|
+
- Raspberry Pi 3B+ or later (64-bit OS recommended)
|
|
337
|
+
- At least 1 GB RAM (2 GB or more recommended)
|
|
338
|
+
- sudo privileges
|
|
339
|
+
- Node.js installed
|
|
340
|
+
- Internet connectivity
|
|
341
|
+
|
|
342
|
+
**Architecture Note**: Raspberry Pi OS supports both 32-bit (armhf/armv7l) and 64-bit (arm64/aarch64) versions. Yarn works on both architectures.
|
|
343
|
+
|
|
344
|
+
First, verify your architecture:
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
uname -m
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
- `aarch64` = 64-bit ARM (recommended)
|
|
351
|
+
- `armv7l` = 32-bit ARM
|
|
352
|
+
|
|
353
|
+
#### Installation Steps
|
|
354
|
+
|
|
355
|
+
The installation process is identical to Ubuntu/Debian since Raspberry Pi OS is Debian-based.
|
|
356
|
+
|
|
357
|
+
**Step 1: Remove conflicting packages**
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get remove -y cmdtest 2>/dev/null || true
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
**Step 2: Install prerequisites**
|
|
364
|
+
|
|
365
|
+
```bash
|
|
366
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
|
367
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y curl gnupg ca-certificates
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
**Step 3: Add the Yarn GPG key and repository**
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /etc/apt/keyrings/yarn-archive-keyring.gpg > /dev/null
|
|
374
|
+
echo "deb [signed-by=/etc/apt/keyrings/yarn-archive-keyring.gpg] https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list > /dev/null
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
**Step 4: Install Yarn**
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
|
381
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y yarn
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
#### Verification
|
|
385
|
+
|
|
386
|
+
Confirm the installation succeeded:
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
yarn --version
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
Expected output (version numbers may vary):
|
|
393
|
+
|
|
394
|
+
```
|
|
395
|
+
1.22.22
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
Test Yarn works with your architecture:
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
yarn config list
|
|
402
|
+
node -e "console.log('Yarn is working on ' + process.arch)"
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
Expected output:
|
|
406
|
+
|
|
407
|
+
```
|
|
408
|
+
Yarn is working on arm64
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
(or `arm` for 32-bit systems)
|
|
412
|
+
|
|
413
|
+
#### Troubleshooting
|
|
414
|
+
|
|
415
|
+
**Problem**: Installation is very slow
|
|
416
|
+
|
|
417
|
+
**Solution**: Raspberry Pi SD cards can be slow. Use a high-quality SD card (Class 10, A1/A2 rated) or boot from USB/SSD for better performance.
|
|
418
|
+
|
|
419
|
+
**Problem**: `yarn install` fails with out of memory errors
|
|
420
|
+
|
|
421
|
+
**Solution**: Raspberry Pi has limited RAM. Increase swap space:
|
|
422
|
+
|
|
423
|
+
```bash
|
|
424
|
+
sudo fallocate -l 2G /swapfile
|
|
425
|
+
sudo chmod 600 /swapfile
|
|
426
|
+
sudo mkswap /swapfile
|
|
427
|
+
sudo swapon /swapfile
|
|
428
|
+
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
**Problem**: Yarn cannot find Node.js on ARMv6 (Pi Zero/Pi 1)
|
|
432
|
+
|
|
433
|
+
**Solution**: ARMv6 requires unofficial Node.js builds. See the Node.js documentation for ARMv6 installation, then install Yarn via npm:
|
|
434
|
+
|
|
435
|
+
```bash
|
|
436
|
+
npm install -g yarn
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
### Amazon Linux/RHEL (YUM/DNF)
|
|
442
|
+
|
|
443
|
+
#### Prerequisites
|
|
444
|
+
|
|
445
|
+
- Amazon Linux 2023 (AL2023) or Amazon Linux 2 (AL2)
|
|
446
|
+
- Alternatively: RHEL 8+, CentOS Stream 8+, Fedora 36+
|
|
447
|
+
- sudo privileges
|
|
448
|
+
- Node.js installed
|
|
449
|
+
- Internet connectivity
|
|
450
|
+
|
|
451
|
+
**Note**: Amazon Linux 2023 uses DNF as the package manager. Amazon Linux 2 uses YUM. The commands below work with both.
|
|
452
|
+
|
|
453
|
+
#### Installation Steps
|
|
454
|
+
|
|
455
|
+
**Step 1: Import the Yarn GPG key**
|
|
456
|
+
|
|
457
|
+
```bash
|
|
458
|
+
sudo rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
**Step 2: Add the Yarn repository**
|
|
462
|
+
|
|
463
|
+
```bash
|
|
464
|
+
sudo curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
**Step 3: Install Yarn**
|
|
468
|
+
|
|
469
|
+
For Amazon Linux 2023 / RHEL 8+ / Fedora (DNF):
|
|
470
|
+
|
|
471
|
+
```bash
|
|
472
|
+
sudo dnf install -y yarn
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
For Amazon Linux 2 / RHEL 7 / CentOS 7 (YUM):
|
|
476
|
+
|
|
477
|
+
```bash
|
|
478
|
+
sudo yum install -y yarn
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
The `-y` flag automatically confirms the installation, making this suitable for scripts and automation.
|
|
482
|
+
|
|
483
|
+
#### Verification
|
|
484
|
+
|
|
485
|
+
Confirm the installation succeeded:
|
|
486
|
+
|
|
487
|
+
```bash
|
|
488
|
+
yarn --version
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
Expected output (version numbers may vary):
|
|
492
|
+
|
|
493
|
+
```
|
|
494
|
+
1.22.22
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
Verify the installation location:
|
|
498
|
+
|
|
499
|
+
```bash
|
|
500
|
+
which yarn
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
Expected output:
|
|
504
|
+
|
|
505
|
+
```
|
|
506
|
+
/usr/bin/yarn
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
Test Yarn works:
|
|
510
|
+
|
|
511
|
+
```bash
|
|
512
|
+
yarn config list
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
#### Troubleshooting
|
|
516
|
+
|
|
517
|
+
**Problem**: `No package yarn available`
|
|
518
|
+
|
|
519
|
+
**Solution**: The Yarn repository was not added correctly. Verify the repo file exists:
|
|
520
|
+
|
|
521
|
+
```bash
|
|
522
|
+
cat /etc/yum.repos.d/yarn.repo
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
If empty or missing, re-run the repository setup:
|
|
526
|
+
|
|
527
|
+
```bash
|
|
528
|
+
sudo curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo
|
|
529
|
+
sudo dnf clean all # or: sudo yum clean all
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
**Problem**: GPG key verification fails
|
|
533
|
+
|
|
534
|
+
**Solution**: Import the GPG key:
|
|
535
|
+
|
|
536
|
+
```bash
|
|
537
|
+
sudo rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
**Problem**: Yarn cannot find Node.js
|
|
541
|
+
|
|
542
|
+
**Solution**: Install Node.js first. For Amazon Linux 2023:
|
|
543
|
+
|
|
544
|
+
```bash
|
|
545
|
+
sudo dnf install -y nodejs22 nodejs22-npm
|
|
546
|
+
sudo alternatives --set node /usr/bin/node-22
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
For Amazon Linux 2:
|
|
550
|
+
|
|
551
|
+
```bash
|
|
552
|
+
curl -fsSL https://rpm.nodesource.com/setup_22.x | sudo bash -
|
|
553
|
+
sudo yum install -y nodejs
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
---
|
|
557
|
+
|
|
558
|
+
### Windows (Chocolatey)
|
|
559
|
+
|
|
560
|
+
#### Prerequisites
|
|
561
|
+
|
|
562
|
+
- Windows 10 version 1903 or higher (64-bit), or Windows 11
|
|
563
|
+
- Administrator PowerShell or Command Prompt
|
|
564
|
+
- Chocolatey package manager installed
|
|
565
|
+
- Node.js installed (Chocolatey can install it automatically)
|
|
566
|
+
- Internet connectivity
|
|
567
|
+
|
|
568
|
+
If Chocolatey is not installed, install it first by running this command in an Administrator PowerShell:
|
|
569
|
+
|
|
570
|
+
```powershell
|
|
571
|
+
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
If Node.js is not installed, install it first:
|
|
575
|
+
|
|
576
|
+
```powershell
|
|
577
|
+
choco install nodejs-lts -y
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
#### Installation Steps
|
|
581
|
+
|
|
582
|
+
Run the following command in an Administrator PowerShell or Command Prompt:
|
|
583
|
+
|
|
584
|
+
```powershell
|
|
585
|
+
choco install yarn -y
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
The `-y` flag automatically confirms all prompts, enabling fully non-interactive installation suitable for automation and scripts. This installs Yarn Classic (1.22.x).
|
|
589
|
+
|
|
590
|
+
After installation, close and reopen your terminal to ensure PATH changes take effect.
|
|
591
|
+
|
|
592
|
+
#### Verification
|
|
593
|
+
|
|
594
|
+
Open a new Command Prompt or PowerShell window, then run:
|
|
595
|
+
|
|
596
|
+
```powershell
|
|
597
|
+
yarn --version
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
Expected output (version numbers may vary):
|
|
601
|
+
|
|
602
|
+
```
|
|
603
|
+
1.22.22
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
Verify the installation location:
|
|
607
|
+
|
|
608
|
+
```powershell
|
|
609
|
+
where yarn
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
Expected output:
|
|
613
|
+
|
|
614
|
+
```
|
|
615
|
+
C:\Program Files (x86)\Yarn\bin\yarn
|
|
616
|
+
C:\Program Files (x86)\Yarn\bin\yarn.cmd
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
Test Yarn works:
|
|
620
|
+
|
|
621
|
+
```powershell
|
|
622
|
+
yarn config list
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
#### Troubleshooting
|
|
626
|
+
|
|
627
|
+
**Problem**: `'yarn' is not recognized as an internal or external command`
|
|
628
|
+
|
|
629
|
+
**Solution**: Close and reopen your terminal window. If the problem persists, verify Yarn is in your PATH:
|
|
630
|
+
|
|
631
|
+
```powershell
|
|
632
|
+
$env:PATH -split ';' | Select-String -Pattern 'Yarn'
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
If not listed, add it manually or reinstall:
|
|
636
|
+
|
|
637
|
+
```powershell
|
|
638
|
+
choco uninstall yarn -y
|
|
639
|
+
choco install yarn -y
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
**Problem**: Chocolatey installation fails
|
|
643
|
+
|
|
644
|
+
**Solution**: Ensure you are running PowerShell as Administrator. Right-click PowerShell and select "Run as administrator".
|
|
645
|
+
|
|
646
|
+
**Problem**: Node.js not found
|
|
647
|
+
|
|
648
|
+
**Solution**: Install Node.js before Yarn:
|
|
649
|
+
|
|
650
|
+
```powershell
|
|
651
|
+
choco install nodejs-lts -y
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
Close and reopen your terminal, then install Yarn.
|
|
655
|
+
|
|
656
|
+
**Problem**: SSL/TLS errors during installation
|
|
657
|
+
|
|
658
|
+
**Solution**: Update your security protocols before installing:
|
|
659
|
+
|
|
660
|
+
```powershell
|
|
661
|
+
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
|
662
|
+
choco install yarn -y
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
---
|
|
666
|
+
|
|
667
|
+
### WSL (Ubuntu)
|
|
668
|
+
|
|
669
|
+
#### Prerequisites
|
|
670
|
+
|
|
671
|
+
- Windows 10 version 2004 or higher, or Windows 11
|
|
672
|
+
- WSL 2 enabled with Ubuntu distribution installed
|
|
673
|
+
- sudo privileges within WSL
|
|
674
|
+
- Node.js installed within WSL
|
|
675
|
+
- Internet connectivity
|
|
676
|
+
|
|
677
|
+
WSL runs Ubuntu (or another Linux distribution) within Windows. Yarn must be installed separately within WSL, as it does not share binaries with Windows.
|
|
678
|
+
|
|
679
|
+
#### Installation Steps
|
|
680
|
+
|
|
681
|
+
Open your WSL Ubuntu terminal and run:
|
|
682
|
+
|
|
683
|
+
**Step 1: Remove conflicting packages**
|
|
684
|
+
|
|
685
|
+
```bash
|
|
686
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get remove -y cmdtest 2>/dev/null || true
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
**Step 2: Install prerequisites**
|
|
690
|
+
|
|
691
|
+
```bash
|
|
692
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
|
693
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y curl gnupg ca-certificates
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
**Step 3: Add the Yarn GPG key and repository**
|
|
697
|
+
|
|
698
|
+
```bash
|
|
699
|
+
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /etc/apt/keyrings/yarn-archive-keyring.gpg > /dev/null
|
|
700
|
+
echo "deb [signed-by=/etc/apt/keyrings/yarn-archive-keyring.gpg] https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list > /dev/null
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
**Step 4: Install Yarn**
|
|
704
|
+
|
|
705
|
+
```bash
|
|
706
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
|
707
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y yarn
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
#### Verification
|
|
711
|
+
|
|
712
|
+
Confirm the installation succeeded:
|
|
713
|
+
|
|
714
|
+
```bash
|
|
715
|
+
yarn --version
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
Expected output (version numbers may vary):
|
|
719
|
+
|
|
720
|
+
```
|
|
721
|
+
1.22.22
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
Verify the installation location:
|
|
725
|
+
|
|
726
|
+
```bash
|
|
727
|
+
which yarn
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
Expected output:
|
|
731
|
+
|
|
732
|
+
```
|
|
733
|
+
/usr/bin/yarn
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
#### Troubleshooting
|
|
737
|
+
|
|
738
|
+
**Problem**: Yarn version differs between WSL and Windows
|
|
739
|
+
|
|
740
|
+
**Solution**: This is expected behavior. WSL and Windows maintain separate Yarn installations. Use the appropriate installation for each environment:
|
|
741
|
+
|
|
742
|
+
- Inside WSL terminal: Use Linux Yarn (`/usr/bin/yarn`)
|
|
743
|
+
- In Windows PowerShell/CMD: Use Windows Yarn (`C:\Program Files (x86)\Yarn\bin\yarn`)
|
|
744
|
+
|
|
745
|
+
**Problem**: `yarn install` is slow or times out
|
|
746
|
+
|
|
747
|
+
**Solution**: WSL file system performance is better on the Linux filesystem. Store your projects in the WSL home directory (`~/projects`) rather than Windows mounts (`/mnt/c/...`):
|
|
748
|
+
|
|
749
|
+
```bash
|
|
750
|
+
mkdir -p ~/projects
|
|
751
|
+
cd ~/projects
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
**Problem**: Node.js not found
|
|
755
|
+
|
|
756
|
+
**Solution**: Install Node.js in WSL using the NodeSource repository:
|
|
757
|
+
|
|
758
|
+
```bash
|
|
759
|
+
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
|
|
760
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
---
|
|
764
|
+
|
|
765
|
+
### Git Bash (Windows Installation)
|
|
766
|
+
|
|
767
|
+
#### Prerequisites
|
|
768
|
+
|
|
769
|
+
- Windows 10 or Windows 11 (64-bit)
|
|
770
|
+
- Git Bash installed (comes with Git for Windows)
|
|
771
|
+
- Administrator access for installation
|
|
772
|
+
- Node.js and Yarn installed on Windows
|
|
773
|
+
- Internet connectivity
|
|
774
|
+
|
|
775
|
+
**Note**: Git Bash on Windows does not require a separate Yarn installation. Git Bash inherits the Windows PATH, so once Yarn is installed on Windows, the `yarn` command is automatically available in Git Bash.
|
|
776
|
+
|
|
777
|
+
#### Installation Steps
|
|
778
|
+
|
|
779
|
+
**Step 1: Install Yarn on Windows using Chocolatey**
|
|
780
|
+
|
|
781
|
+
Run the following command in an Administrator PowerShell or Command Prompt:
|
|
782
|
+
|
|
783
|
+
```powershell
|
|
784
|
+
choco install yarn -y
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
**Step 2: Close and reopen Git Bash**
|
|
788
|
+
|
|
789
|
+
After installation, close any open Git Bash windows and open a new one to pick up the updated PATH.
|
|
790
|
+
|
|
791
|
+
**Step 3: Verify Yarn is accessible**
|
|
792
|
+
|
|
793
|
+
In Git Bash:
|
|
794
|
+
|
|
795
|
+
```bash
|
|
796
|
+
yarn --version
|
|
797
|
+
```
|
|
798
|
+
|
|
799
|
+
#### Verification
|
|
800
|
+
|
|
801
|
+
In Git Bash, confirm Yarn is accessible:
|
|
802
|
+
|
|
803
|
+
```bash
|
|
804
|
+
yarn --version
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
Expected output (version numbers may vary):
|
|
808
|
+
|
|
809
|
+
```
|
|
810
|
+
1.22.22
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
Verify the PATH includes Yarn:
|
|
814
|
+
|
|
815
|
+
```bash
|
|
816
|
+
which yarn
|
|
817
|
+
```
|
|
818
|
+
|
|
819
|
+
Expected output:
|
|
820
|
+
|
|
821
|
+
```
|
|
822
|
+
/c/Program Files (x86)/Yarn/bin/yarn
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
Test Yarn works:
|
|
826
|
+
|
|
827
|
+
```bash
|
|
828
|
+
yarn config list
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
#### Troubleshooting
|
|
832
|
+
|
|
833
|
+
**Problem**: `yarn: command not found` in Git Bash
|
|
834
|
+
|
|
835
|
+
**Solution**: Yarn may not be in PATH or Git Bash was opened before installation completed. First, close and reopen Git Bash. Then verify the PATH includes Yarn:
|
|
836
|
+
|
|
837
|
+
```bash
|
|
838
|
+
echo $PATH | tr ':' '\n' | grep -i yarn
|
|
839
|
+
```
|
|
840
|
+
|
|
841
|
+
If Yarn is not in PATH, add it to your `~/.bashrc`:
|
|
842
|
+
|
|
843
|
+
```bash
|
|
844
|
+
echo 'export PATH="$PATH:/c/Program Files (x86)/Yarn/bin"' >> ~/.bashrc
|
|
845
|
+
source ~/.bashrc
|
|
846
|
+
```
|
|
847
|
+
|
|
848
|
+
**Problem**: `the input device is not a TTY` error with interactive commands
|
|
849
|
+
|
|
850
|
+
**Solution**: Git Bash's mintty terminal has TTY compatibility issues. Use the `winpty` prefix for interactive commands:
|
|
851
|
+
|
|
852
|
+
```bash
|
|
853
|
+
winpty yarn
|
|
854
|
+
```
|
|
855
|
+
|
|
856
|
+
Or add an alias to your `~/.bashrc`:
|
|
857
|
+
|
|
858
|
+
```bash
|
|
859
|
+
echo 'alias yarn="winpty yarn"' >> ~/.bashrc
|
|
860
|
+
source ~/.bashrc
|
|
861
|
+
```
|
|
862
|
+
|
|
863
|
+
**Problem**: Path conversion issues (Unix paths being converted to Windows paths)
|
|
864
|
+
|
|
865
|
+
**Solution**: Git Bash automatically converts Unix-style paths. To prevent this for specific commands, set `MSYS_NO_PATHCONV`:
|
|
866
|
+
|
|
867
|
+
```bash
|
|
868
|
+
MSYS_NO_PATHCONV=1 yarn add /path/to/local/package
|
|
869
|
+
```
|
|
870
|
+
|
|
871
|
+
---
|
|
872
|
+
|
|
873
|
+
## Post-Installation Configuration
|
|
874
|
+
|
|
875
|
+
After installing Yarn on any platform, consider these optional but recommended configurations.
|
|
876
|
+
|
|
877
|
+
### Verify Yarn is Working
|
|
878
|
+
|
|
879
|
+
Test Yarn by checking its version and configuration:
|
|
880
|
+
|
|
881
|
+
```bash
|
|
882
|
+
yarn --version
|
|
883
|
+
yarn config list
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
### Set Default Registry
|
|
887
|
+
|
|
888
|
+
Yarn uses the npm registry by default. To verify or set the registry:
|
|
889
|
+
|
|
890
|
+
```bash
|
|
891
|
+
yarn config get registry
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
Expected output:
|
|
895
|
+
|
|
896
|
+
```
|
|
897
|
+
https://registry.yarnpkg.com
|
|
898
|
+
```
|
|
899
|
+
|
|
900
|
+
To use the npm registry instead:
|
|
901
|
+
|
|
902
|
+
```bash
|
|
903
|
+
yarn config set registry https://registry.npmjs.org
|
|
904
|
+
```
|
|
905
|
+
|
|
906
|
+
### Configure Yarn Initialization Defaults
|
|
907
|
+
|
|
908
|
+
Set default values for `yarn init`:
|
|
909
|
+
|
|
910
|
+
```bash
|
|
911
|
+
yarn config set init-author-name "Your Name"
|
|
912
|
+
yarn config set init-author-email "your.email@example.com"
|
|
913
|
+
yarn config set init-license "MIT"
|
|
914
|
+
```
|
|
915
|
+
|
|
916
|
+
### Configure Offline Mirror (Optional)
|
|
917
|
+
|
|
918
|
+
For offline installations or faster CI/CD, configure a local cache:
|
|
919
|
+
|
|
920
|
+
```bash
|
|
921
|
+
yarn config set yarn-offline-mirror ./npm-packages-offline-cache
|
|
922
|
+
yarn config set yarn-offline-mirror-pruning true
|
|
923
|
+
```
|
|
924
|
+
|
|
925
|
+
### Upgrade to Yarn Modern (Per-Project)
|
|
926
|
+
|
|
927
|
+
If a project requires Yarn 2+ (Berry), use Corepack after installing Node.js 16.10+:
|
|
928
|
+
|
|
929
|
+
```bash
|
|
930
|
+
corepack enable
|
|
931
|
+
cd /path/to/your/project
|
|
932
|
+
yarn set version stable
|
|
933
|
+
yarn install
|
|
934
|
+
```
|
|
935
|
+
|
|
936
|
+
This creates project-specific Yarn configuration without affecting your global Yarn Classic installation.
|
|
937
|
+
|
|
938
|
+
---
|
|
939
|
+
|
|
940
|
+
## Common Issues
|
|
941
|
+
|
|
942
|
+
### Issue: "There appears to be trouble with your network connection"
|
|
943
|
+
|
|
944
|
+
**Symptoms**: Yarn cannot download packages, displays network retry messages
|
|
945
|
+
|
|
946
|
+
**Solutions**:
|
|
947
|
+
|
|
948
|
+
- Check your internet connection
|
|
949
|
+
- If behind a corporate proxy, configure Yarn:
|
|
950
|
+
|
|
951
|
+
```bash
|
|
952
|
+
yarn config set proxy http://proxy.example.com:8080
|
|
953
|
+
yarn config set https-proxy http://proxy.example.com:8080
|
|
954
|
+
```
|
|
955
|
+
|
|
956
|
+
- Increase network timeout:
|
|
957
|
+
|
|
958
|
+
```bash
|
|
959
|
+
yarn config set network-timeout 300000
|
|
960
|
+
```
|
|
961
|
+
|
|
962
|
+
### Issue: "Integrity check failed" or Checksum Mismatch
|
|
963
|
+
|
|
964
|
+
**Symptoms**: `error Integrity check failed for "package-name"`
|
|
965
|
+
|
|
966
|
+
**Solutions**:
|
|
967
|
+
|
|
968
|
+
- Clear the Yarn cache:
|
|
969
|
+
|
|
970
|
+
```bash
|
|
971
|
+
yarn cache clean
|
|
972
|
+
```
|
|
973
|
+
|
|
974
|
+
- Delete `yarn.lock` and `node_modules`, then reinstall:
|
|
975
|
+
|
|
976
|
+
```bash
|
|
977
|
+
rm -rf node_modules yarn.lock
|
|
978
|
+
yarn install
|
|
979
|
+
```
|
|
980
|
+
|
|
981
|
+
### Issue: Permission Denied Errors
|
|
982
|
+
|
|
983
|
+
**Symptoms**: `EACCES: permission denied` when running Yarn commands
|
|
984
|
+
|
|
985
|
+
**Solutions**:
|
|
986
|
+
|
|
987
|
+
- Do not use `sudo` with Yarn - it creates permission issues
|
|
988
|
+
- Fix npm global directory permissions:
|
|
989
|
+
|
|
990
|
+
```bash
|
|
991
|
+
mkdir -p ~/.npm-global
|
|
992
|
+
npm config set prefix '~/.npm-global'
|
|
993
|
+
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc # or ~/.zshrc on macOS
|
|
994
|
+
source ~/.bashrc
|
|
995
|
+
```
|
|
996
|
+
|
|
997
|
+
### Issue: Yarn Classic vs Modern Confusion
|
|
998
|
+
|
|
999
|
+
**Symptoms**: Different Yarn behavior or commands across projects
|
|
1000
|
+
|
|
1001
|
+
**Solutions**:
|
|
1002
|
+
|
|
1003
|
+
- Check which version a project uses:
|
|
1004
|
+
|
|
1005
|
+
```bash
|
|
1006
|
+
yarn --version
|
|
1007
|
+
```
|
|
1008
|
+
|
|
1009
|
+
- Yarn 1.x uses `yarn.lock` and `node_modules`
|
|
1010
|
+
- Yarn 2+ may use `.yarnrc.yml`, `.pnp.cjs`, and `.yarn/` directory
|
|
1011
|
+
- To use a specific version per-project:
|
|
1012
|
+
|
|
1013
|
+
```bash
|
|
1014
|
+
# For Yarn Modern
|
|
1015
|
+
corepack enable
|
|
1016
|
+
yarn set version stable
|
|
1017
|
+
|
|
1018
|
+
# For Yarn Classic
|
|
1019
|
+
yarn set version classic
|
|
1020
|
+
```
|
|
1021
|
+
|
|
1022
|
+
### Issue: "The engine 'node' is incompatible with this module"
|
|
1023
|
+
|
|
1024
|
+
**Symptoms**: Yarn refuses to install packages due to Node.js version mismatch
|
|
1025
|
+
|
|
1026
|
+
**Solutions**:
|
|
1027
|
+
|
|
1028
|
+
- Check your Node.js version:
|
|
1029
|
+
|
|
1030
|
+
```bash
|
|
1031
|
+
node --version
|
|
1032
|
+
```
|
|
1033
|
+
|
|
1034
|
+
- Install the required Node.js version (use nvm for version management)
|
|
1035
|
+
- To ignore engine checks (not recommended for production):
|
|
1036
|
+
|
|
1037
|
+
```bash
|
|
1038
|
+
yarn install --ignore-engines
|
|
1039
|
+
```
|
|
1040
|
+
|
|
1041
|
+
### Issue: Slow Installation Times
|
|
1042
|
+
|
|
1043
|
+
**Symptoms**: `yarn install` takes very long
|
|
1044
|
+
|
|
1045
|
+
**Solutions**:
|
|
1046
|
+
|
|
1047
|
+
- Check if offline mirror is configured and populated
|
|
1048
|
+
- Use `--prefer-offline` for cached packages:
|
|
1049
|
+
|
|
1050
|
+
```bash
|
|
1051
|
+
yarn install --prefer-offline
|
|
1052
|
+
```
|
|
1053
|
+
|
|
1054
|
+
- For CI/CD, use `--frozen-lockfile` to skip resolution:
|
|
1055
|
+
|
|
1056
|
+
```bash
|
|
1057
|
+
yarn install --frozen-lockfile
|
|
1058
|
+
```
|
|
1059
|
+
|
|
1060
|
+
---
|
|
1061
|
+
|
|
1062
|
+
## References
|
|
1063
|
+
|
|
1064
|
+
- [Yarn Official Website](https://yarnpkg.com/)
|
|
1065
|
+
- [Yarn Classic Documentation](https://classic.yarnpkg.com/)
|
|
1066
|
+
- [Yarn Installation Guide (Modern)](https://yarnpkg.com/getting-started/install)
|
|
1067
|
+
- [Yarn Classic Installation Guide](https://classic.yarnpkg.com/lang/en/docs/install/)
|
|
1068
|
+
- [Yarn GitHub Repository (Classic 1.x)](https://github.com/yarnpkg/yarn)
|
|
1069
|
+
- [Yarn GitHub Repository (Modern/Berry)](https://github.com/yarnpkg/berry)
|
|
1070
|
+
- [Homebrew Yarn Formula](https://formulae.brew.sh/formula/yarn)
|
|
1071
|
+
- [Chocolatey Yarn Package](https://community.chocolatey.org/packages/yarn)
|
|
1072
|
+
- [Yarn APT/RPM Repository](https://github.com/yarnpkg/releases)
|
|
1073
|
+
- [Node.js Corepack Documentation](https://nodejs.org/api/corepack.html)
|
|
1074
|
+
- [Yarn Corepack Integration](https://yarnpkg.com/corepack)
|