Skip to content

env: node: No such file or directory - cc-switch

Quick fix

Upgrade cc-switch to v3.18.0+, which fixes node not being found when updating Codex because a macOS GUI launch has no PATH.

Error output
env: node: No such file or directory

On macOS, launching cc-switch from Finder or the Dock gives the GUI process a system PATH that does not include the Homebrew directories (/opt/homebrew/bin). Since the npm and Codex launch scripts rely on `#!/usr/bin/env node`, the missing PATH means node cannot be resolved and update or lifecycle commands fail.

Note the cluster also holds other environment detection variants. On Windows, the extension-less codex shim npm generates was once misread as a separate install, producing a "several installations detected" warning (fixed in v3.16.5). Conversations disappearing after a WSL environment switch is a Codex problem in its own right.

  1. Upgrade cc-switch to v3.18.0 or newer. That version injects the correct PATH when calling npm, so node resolves properly.

  2. If you cannot upgrade right away, launch cc-switch from a terminal on the command line so it inherits the terminal's full PATH, rather than from Finder or the Dock.

Toolcc-switch
Version3.16.2 - 3.16.4 (受影响范围),v3.18.0 修复
PlatformsmacOSWindows
Windows reports "several installations detected" and the extension-less codex shows as unrunnable. What now?
That is a misjudgement in cc-switch v3.16.4 and earlier. On Windows, npm generates codex, codex.cmd, and codex.ps1 together; upgrading cc-switch to v3.16.5 or newer merges them into one detection automatically.
My project conversations disappeared after switching the agent environment from PowerShell to WSL in cc-switch.
That is a problem in the Codex app itself rather than a cc-switch bug — report it to Codex.

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.