Skip to content

Instantly share code, notes, and snippets.

@AniTexs
Last active July 22, 2025 17:59
Show Gist options
  • Select an option

  • Save AniTexs/5a31efa79f6b5708449a3067cd12d25a to your computer and use it in GitHub Desktop.

Select an option

Save AniTexs/5a31efa79f6b5708449a3067cd12d25a to your computer and use it in GitHub Desktop.
OpenAI Codex Laravel Yarn Setup
#!/usr/bin/env bash
NODE_VERSION="${NODE_VERSION:-20}"
YARN_VERSION="${YARN_VERSION:-1.22.22}"
# Install the desired Node LTS via NodeSource
curl -fsSL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | bash -
apt-get install -y nodejs
# ---------------------------------------------------------------------------
# Yarn (via Corepack)
# ---------------------------------------------------------------------------
# Node ≥16 ships with Corepack, which can activate pinned versions of Yarn.
# This avoids npm‑global install conflicts and sticks to a reproducible version.
if ! command -v corepack >/dev/null 2>&1; then
# Fallback for odd Node builds that omit Corepack
npm install -g corepack
fi
corepack enable
corepack prepare "yarn@${YARN_VERSION}" --activate
node -v; yarn -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment