Source: YouTube URL: https://www.youtube.com/watch?v=GrHXYvBKD2Q Date: 2025-10-10 Duration: 4:14
This tutorial demonstrates how to install ChatGPT Codex in console environments on both Windows 11 and Windows Subsystem for Linux (WSL). The process involves installing Node.js first, then using npm to install the Codex package, followed by authentication with OpenAI.
npm install codexNode.js Setup The installation begins with checking
if Node.js is installed by running node -v. If the system
returns an error stating the program is not recognized, Node.js needs to
be installed. The installation uses the official Windows installer from
nodejs.org, which includes both Node.js and npm (Node Package
Manager).
Security Warnings During installation, users may encounter two security warnings: 1. Browser warning about downloaded files (can be safely ignored for official Node.js installer) 2. Windows User Account Control (UAC) prompt requesting permission to make system changes (must be approved)
Codex Installation After Node.js installation, the PowerShell window must be reloaded to recognize the new commands. The Codex package is then installed using npm. Upon first launch, Codex displays a performance recommendation suggesting WSL usage, though users can continue with native Windows if preferred.
Initial Configuration Codex prompts users to configure edit approval settings. Choosing “no” means Codex will ask for permission before each file modification, providing more control over changes.
Authentication Status If Visual Studio Code with
Codex was previously installed, the terminal version may already be
authenticated. Users can verify login status with the
/status command.
Common Installation Error When attempting to install Codex directly in WSL without preparation, users encounter an error indicating npm is not installed. This is a critical prerequisite that must be addressed first.
Linux Package Installation Sequence 1. Install Node.js using the Linux package manager 2. Install npm separately (described as a “large program” requiring notable time) 3. Install Codex via npm (now succeeds)
Authentication in WSL Unlike the Windows installation where authentication may carry over from VS Code, WSL requires fresh authentication. The process involves: 1. Copying a URL provided by Codex 2. Opening the URL in a browser 3. Authenticating with OpenAI using preferred provider (Google, Microsoft, etc.) 4. Returning to the terminal after browser authentication completes
Edit Approval Configuration Similar to Windows, WSL users must configure whether Codex requires approval for each edit.
Performance Optimization Codex explicitly recommends WSL for best performance, suggesting Microsoft’s subsystem provides a more optimal environment than native Windows for console-based AI coding tools.
Cross-Platform Compatibility The instructor notes that the WSL/Ubuntu installation procedure should work for most Linux distributions, though specific package manager commands may vary.
Authentication Persistence Authentication state appears to be environment-specific. VS Code authentication does not automatically extend to terminal installations, requiring separate sign-in for each environment.
“For the best performance, Codex should be run in the Windows subsystem for Linux.”
“If you see this error message, then it states that the program is not recognized and thus not installed on your system.”
“I deliberately did this because I want to show you a pitfall you might fall in.”
“Now I’m sure that this last procedure to install Codex is working with most Linux distributions too.”
本教學展示如何在 Windows 11 和 Windows 子系統 Linux (WSL) 的控制台環境中安裝 ChatGPT Codex。安裝過程包括先安裝 Node.js,然後使用 npm 安裝 Codex 套件,最後進行 OpenAI 身份驗證。
npm install codex 指令安裝 CodexNode.js 設定 安裝首先透過執行 node -v
檢查是否已安裝 Node.js。如果系統返回錯誤訊息表示程式無法識別,則需要安裝
Node.js。安裝使用來自 nodejs.org 的官方 Windows 安裝程式,其中包含
Node.js 和 npm(Node 套件管理器)。
安全性警告 安裝過程中,使用者可能遇到兩個安全性警告: 1. 瀏覽器關於下載檔案的警告(對於官方 Node.js 安裝程式可以安全忽略) 2. Windows 使用者帳戶控制(UAC)提示請求允許進行系統變更(必須批准)
Codex 安裝 安裝 Node.js 後,必須重新載入 PowerShell 視窗以識別新指令。然後使用 npm 安裝 Codex 套件。首次啟動時,Codex 會顯示效能建議,建議使用 WSL,但使用者可以選擇繼續使用原生 Windows。
初始設定 Codex 提示使用者設定編輯批准設定。選擇「否」表示 Codex 在每次檔案修改前都會要求許可,提供更多對變更的控制。
驗證狀態 如果之前已在 Visual Studio Code 中安裝
Codex,終端版本可能已經過身份驗證。使用者可以使用 /status
指令驗證登入狀態。
常見安裝錯誤 在未準備的情況下直接在 WSL 中嘗試安裝 Codex 時,使用者會遇到錯誤訊息,指出 npm 未安裝。這是必須首先解決的關鍵前提條件。
Linux 套件安裝順序 1. 使用 Linux 套件管理器安裝 Node.js 2. 單獨安裝 npm(被描述為「大型程式」,需要相當長的時間) 3. 透過 npm 安裝 Codex(現在成功)
WSL 中的身份驗證 與 Windows 安裝不同(身份驗證可能從 VS Code 延續),WSL 需要全新的身份驗證。流程包括: 1. 複製 Codex 提供的 URL 2. 在瀏覽器中開啟 URL 3. 使用偏好的提供者(Google、Microsoft 等)向 OpenAI 進行身份驗證 4. 瀏覽器身份驗證完成後返回終端機
編輯批准設定 與 Windows 類似,WSL 使用者必須設定 Codex 是否需要每次編輯都獲得批准。
效能最佳化 Codex 明確建議使用 WSL 以獲得最佳效能,表明微軟的子系統為基於控制台的 AI 編碼工具提供了比原生 Windows 更優化的環境。
跨平台相容性 講師指出 WSL/Ubuntu 安裝程序應該適用於大多數 Linux 發行版,儘管特定的套件管理器指令可能有所不同。
身份驗證持久性 身份驗證狀態似乎是特定於環境的。VS Code 身份驗證不會自動擴展到終端安裝,需要為每個環境單獨登入。
「為了獲得最佳效能,Codex 應該在 Windows 子系統 Linux 中運行。」
「如果您看到此錯誤訊息,則表示程式無法識別,因此未安裝在您的系統上。」
「我故意這樣做是因為我想向您展示您可能會陷入的陷阱。」
「現在我確信最後這個安裝 Codex 的程序也適用於大多數 Linux 發行版。」
#ChatGPT #Codex #Installation #Tutorial #Windows11 #WSL #Linux #NodeJS #npm #Terminal #Console #AI #Coding #OpenAI #DeveloperTools