volta icon indicating copy to clipboard operation
volta copied to clipboard

"command not found: yarn"

Open VaidotasSm opened this issue 2 years ago • 2 comments

Problem

volta install yarn@1
success: installed and set [email protected] as default

yarn -v
zsh: command not found: yarn

From what I gather yarn executable is not being generated under ~/.volta/bin.

Details

System - Mac OS 13.0.1, Intel

volta list
⚡️ Currently active tools:

    Node: v18.13.0 (default)
    npm: v9.4.0 (default)
    Yarn: v1.22.21 (default)
    Tool binaries available: NONE


ls -la  ~/.volta/bin
total 37008
drwxr-xr-x@ 9 xxx  staff      288 Jan 31  2023 .
drwxr-xr-x@ 9 xxx  staff      288 Jan 28  2023 ..
lrwxr-xr-x@ 1 xxx  staff       32 Jan 28  2023 node -> /Users/xxx/.volta/bin/volta-shim
lrwxr-xr-x@ 1 xxx  staff       32 Jan 28  2023 npm -> /Users/xxx/.volta/bin/volta-shim
lrwxr-xr-x@ 1 xxx  staff       32 Jan 28  2023 npx -> /Users/xxx/.volta/bin/volta-shim
lrwxr-xr-x@ 1 xxx  staff       32 Jan 28  2023 pnpm -> /Users/xxx/.volta/bin/volta-shim
-rwxr-xr-x@ 1 xxx  staff  7642440 Jan 24  2023 volta
-rwxr-xr-x@ 1 xxx  staff  4617312 Jan 24  2023 volta-migrate
-rwxr-xr-x@ 1 xxx  staff  6680856 Jan 24  2023 volta-shim


ls ~/.volta/tools/image/yarn
1.22.21


ls ~/.volta/tools/inventory/yarn/
yarn-v1.22.21.tar.gz

Workaround

Add to path manually to ~/.zshrc, ~/.profile, ~/.bashrc:

export YARN_HOME="$VOLTA_HOME/tools/image/yarn/1.22.21/"
export PATH=...:$VOLTA_HOME/bin:$YARN_HOME/bin:$PATH

VaidotasSm avatar Dec 20 '23 12:12 VaidotasSm

Not sure what got me into this state last night, but executing volta setup (again) and then restarting my Terminal seemed to bring everything back in order 😬

dwiyatci avatar Jan 04 '24 14:01 dwiyatci

I just had the same problem and know what caused it. I first called volta install yarn and it installed version 4.X Then I called npm install -g corepack and npm uninstall -g corepack then yarn was not found

I fixed it with volta setup as @dwiyatci mentioned (thanks!)

lehotskysamuel avatar Aug 16 '24 08:08 lehotskysamuel