codex icon indicating copy to clipboard operation
codex copied to clipboard

Windows desktop WSL connection resolves the Windows npm codex shim and fails with "exec: node: not found"

Open Irving798 opened this issue 3 weeks ago • 1 comments

What version of the Codex App are you using (From “About Codex” dialog)?

Environment: - Windows 11 Pro 25H2, build 26200.9168 - ChatGPT desktop 26.1103.7773.0 (MSIX OpenAI.Codex_26.1103.7773.0_x64) - WSL 2.7.11.0, kernel 6.18.33.2-2 - Default distro: Ubuntu-24.04 (WSL2); docker-desktop is also registered - Windows Node: nvm-windows at C:\fly_develop\nvm\nodejs (contains an npm-generated POSIX codex shim) - WSL Node: nvm v22.23.2; Codex CLI 0.167.0 at /home/reed/.nvm/versions/node/v22.23.2/bin/codex - WSL project: \wsl.localhost\ubuntu-24.04\home\reed\fly_ai_project\nexora - config.toml: runCodexInWindowsSubsystemForLinux = false; integratedTerminalShell = "powershell" - CODEX_CLI_PATH points to the bundled Windows codex.exe

What subscription do you have?

  • UI: WSL connection failed. - Error: /mnt/c/fly_develop/nvm/nodejs/codex: 15: exec: node: not found - Logs: hostId=remote-wsl:Ubuntu-24.04 [StdioConnection] stdio_transport_spawned argsCount=6 coreRuntimeInUse=false executablePath=wsl.exe spawnCommand=wsl.exe [AppServerConnection] app_server_connection.websocket_error message="/mnt/c/fly_develop/nvm/nodejs/codex: 15: exec: node: not found" code=127 - The app also tries remote-wsl:docker-desktop and fails with "/bin/sh: /usr/bin/bash: not found". docker-desktop is a minimal distro; that is a separate issue.

What platform is your computer?

Environment: - Windows 11 Pro 25H2, build 26200.9168 - ChatGPT desktop 26.1103.7773.0 (MSIX OpenAI.Codex_26.1103.7773.0_x64) - WSL 2.7.11.0, kernel 6.18.33.2-2 - Default distro: Ubuntu-24.04 (WSL2); docker-desktop is also registered - Windows Node: nvm-windows at C:\fly_develop\nvm\nodejs (contains an npm-generated POSIX codex shim) - WSL Node: nvm v22.23.2; Codex CLI 0.167.0 at /home/reed/.nvm/versions/node/v22.23.2/bin/codex - WSL project: \wsl.localhost\ubuntu-24.04\home\reed\fly_ai_project\nexora - config.toml: runCodexInWindowsSubsystemForLinux = false; integratedTerminalShell = "powershell" - CODEX_CLI_PATH points to the bundled Windows codex.exe

What issue are you seeing?

Title: Windows desktop WSL connection resolves the Windows npm codex shim and fails with "exec: node: not found"

Environment:

  • Windows 11 Pro 25H2, build 26200.9168
  • ChatGPT desktop 26.1103.7773.0 (MSIX OpenAI.Codex_26.1103.7773.0_x64)
  • WSL 2.7.11.0, kernel 6.18.33.2-2
  • Default distro: Ubuntu-24.04 (WSL2); docker-desktop is also registered
  • Windows Node: nvm-windows at C:\fly_develop\nvm\nodejs (contains an npm-generated POSIX codex shim)
  • WSL Node: nvm v22.23.2; Codex CLI 0.167.0 at /home/reed/.nvm/versions/node/v22.23.2/bin/codex
  • WSL project: \wsl.localhost\ubuntu-24.04\home\reed\fly_ai_project\nexora
  • config.toml: runCodexInWindowsSubsystemForLinux = false; integratedTerminalShell = "powershell"
  • CODEX_CLI_PATH points to the bundled Windows codex.exe

Steps to reproduce:

  1. Open ChatGPT desktop.
  2. Use the WSL remote connection for Ubuntu-24.04 (Settings -> Connections -> WSL, or open the WSL project).
  3. The app spawns wsl.exe and attempts to start the Codex app-server.

Actual result:

  • UI: WSL connection failed.
  • Error: /mnt/c/fly_develop/nvm/nodejs/codex: 15: exec: node: not found
  • Logs: hostId=remote-wsl:Ubuntu-24.04 [StdioConnection] stdio_transport_spawned argsCount=6 coreRuntimeInUse=false executablePath=wsl.exe spawnCommand=wsl.exe [AppServerConnection] app_server_connection.websocket_error message="/mnt/c/fly_develop/nvm/nodejs/codex: 15: exec: node: not found" code=127
  • The app also tries remote-wsl:docker-desktop and fails with "/bin/sh: /usr/bin/bash: not found". docker-desktop is a minimal distro; that is a separate issue.

Expected result:

  • The WSL remote connection should execute the Linux-native codex in the selected distro, or use the app's bundled Linux WSL binary / an explicitly configured path.
  • It should not resolve codex from the Windows PATH that WSL appends via interop.
  • If it relies on the user's shell environment, it should use a login/interactive shell or source the user's shell init so nvm-managed Node/Codex is visible.

Analysis:

  • WSL non-interactive shells do not load ~/.bashrc; nvm's bin directory is not in PATH.
  • WSL appends the Windows PATH; C:\fly_develop\nvm\nodejs contains an npm-generated POSIX codex shim.
  • The shim runs "exec node"; Linux node is absent, so it fails.
  • In an interactive Ubuntu shell, "which codex" resolves to /home/reed/.nvm/versions/node/v22.23.2/bin/codex and "codex --version" works (0.167.0).
  • The Linux Codex installation is valid; the failure is in the app's WSL-side executable resolution.

Workaround (not applied here):

  • Symlink Linux node/codex into /usr/local/bin, or install system-level Node/Codex.
  • But the app should not require users to modify /usr/local/bin just to make the WSL connection work.

Attachments:

  • Relevant log lines (redacted)
  • config.toml snippet (redacted)
  • Output of "wsl -l -v"
  • Output of non-interactive vs interactive "command -v codex/node"

What steps can reproduce the bug?

Title: Windows desktop WSL connection resolves the Windows npm codex shim and fails with "exec: node: not found"

Environment:

  • Windows 11 Pro 25H2, build 26200.9168
  • ChatGPT desktop 26.1103.7773.0 (MSIX OpenAI.Codex_26.1103.7773.0_x64)
  • WSL 2.7.11.0, kernel 6.18.33.2-2
  • Default distro: Ubuntu-24.04 (WSL2); docker-desktop is also registered
  • Windows Node: nvm-windows at C:\fly_develop\nvm\nodejs (contains an npm-generated POSIX codex shim)
  • WSL Node: nvm v22.23.2; Codex CLI 0.167.0 at /home/reed/.nvm/versions/node/v22.23.2/bin/codex
  • WSL project: \wsl.localhost\ubuntu-24.04\home\reed\fly_ai_project\nexora
  • config.toml: runCodexInWindowsSubsystemForLinux = false; integratedTerminalShell = "powershell"
  • CODEX_CLI_PATH points to the bundled Windows codex.exe

Steps to reproduce:

  1. Open ChatGPT desktop.
  2. Use the WSL remote connection for Ubuntu-24.04 (Settings -> Connections -> WSL, or open the WSL project).
  3. The app spawns wsl.exe and attempts to start the Codex app-server.

Actual result:

  • UI: WSL connection failed.
  • Error: /mnt/c/fly_develop/nvm/nodejs/codex: 15: exec: node: not found
  • Logs: hostId=remote-wsl:Ubuntu-24.04 [StdioConnection] stdio_transport_spawned argsCount=6 coreRuntimeInUse=false executablePath=wsl.exe spawnCommand=wsl.exe [AppServerConnection] app_server_connection.websocket_error message="/mnt/c/fly_develop/nvm/nodejs/codex: 15: exec: node: not found" code=127
  • The app also tries remote-wsl:docker-desktop and fails with "/bin/sh: /usr/bin/bash: not found". docker-desktop is a minimal distro; that is a separate issue.

Expected result:

  • The WSL remote connection should execute the Linux-native codex in the selected distro, or use the app's bundled Linux WSL binary / an explicitly configured path.
  • It should not resolve codex from the Windows PATH that WSL appends via interop.
  • If it relies on the user's shell environment, it should use a login/interactive shell or source the user's shell init so nvm-managed Node/Codex is visible.

Analysis:

  • WSL non-interactive shells do not load ~/.bashrc; nvm's bin directory is not in PATH.
  • WSL appends the Windows PATH; C:\fly_develop\nvm\nodejs contains an npm-generated POSIX codex shim.
  • The shim runs "exec node"; Linux node is absent, so it fails.
  • In an interactive Ubuntu shell, "which codex" resolves to /home/reed/.nvm/versions/node/v22.23.2/bin/codex and "codex --version" works (0.167.0).
  • The Linux Codex installation is valid; the failure is in the app's WSL-side executable resolution.

Workaround (not applied here):

  • Symlink Linux node/codex into /usr/local/bin, or install system-level Node/Codex.
  • But the app should not require users to modify /usr/local/bin just to make the WSL connection work.

Attachments:

  • Relevant log lines (redacted)
  • config.toml snippet (redacted)
  • Output of "wsl -l -v"
  • Output of non-interactive vs interactive "command -v codex/node"

What is the expected behavior?

Title: Windows desktop WSL connection resolves the Windows npm codex shim and fails with "exec: node: not found"

Environment:

  • Windows 11 Pro 25H2, build 26200.9168
  • ChatGPT desktop 26.1103.7773.0 (MSIX OpenAI.Codex_26.1103.7773.0_x64)
  • WSL 2.7.11.0, kernel 6.18.33.2-2
  • Default distro: Ubuntu-24.04 (WSL2); docker-desktop is also registered
  • Windows Node: nvm-windows at C:\fly_develop\nvm\nodejs (contains an npm-generated POSIX codex shim)
  • WSL Node: nvm v22.23.2; Codex CLI 0.167.0 at /home/reed/.nvm/versions/node/v22.23.2/bin/codex
  • WSL project: \wsl.localhost\ubuntu-24.04\home\reed\fly_ai_project\nexora
  • config.toml: runCodexInWindowsSubsystemForLinux = false; integratedTerminalShell = "powershell"
  • CODEX_CLI_PATH points to the bundled Windows codex.exe

Steps to reproduce:

  1. Open ChatGPT desktop.
  2. Use the WSL remote connection for Ubuntu-24.04 (Settings -> Connections -> WSL, or open the WSL project).
  3. The app spawns wsl.exe and attempts to start the Codex app-server.

Actual result:

  • UI: WSL connection failed.
  • Error: /mnt/c/fly_develop/nvm/nodejs/codex: 15: exec: node: not found
  • Logs: hostId=remote-wsl:Ubuntu-24.04 [StdioConnection] stdio_transport_spawned argsCount=6 coreRuntimeInUse=false executablePath=wsl.exe spawnCommand=wsl.exe [AppServerConnection] app_server_connection.websocket_error message="/mnt/c/fly_develop/nvm/nodejs/codex: 15: exec: node: not found" code=127
  • The app also tries remote-wsl:docker-desktop and fails with "/bin/sh: /usr/bin/bash: not found". docker-desktop is a minimal distro; that is a separate issue.

Expected result:

  • The WSL remote connection should execute the Linux-native codex in the selected distro, or use the app's bundled Linux WSL binary / an explicitly configured path.
  • It should not resolve codex from the Windows PATH that WSL appends via interop.
  • If it relies on the user's shell environment, it should use a login/interactive shell or source the user's shell init so nvm-managed Node/Codex is visible.

Analysis:

  • WSL non-interactive shells do not load ~/.bashrc; nvm's bin directory is not in PATH.
  • WSL appends the Windows PATH; C:\fly_develop\nvm\nodejs contains an npm-generated POSIX codex shim.
  • The shim runs "exec node"; Linux node is absent, so it fails.
  • In an interactive Ubuntu shell, "which codex" resolves to /home/reed/.nvm/versions/node/v22.23.2/bin/codex and "codex --version" works (0.167.0).
  • The Linux Codex installation is valid; the failure is in the app's WSL-side executable resolution.

Workaround (not applied here):

  • Symlink Linux node/codex into /usr/local/bin, or install system-level Node/Codex.
  • But the app should not require users to modify /usr/local/bin just to make the WSL connection work.

Attachments:

  • Relevant log lines (redacted)
  • config.toml snippet (redacted)
  • Output of "wsl -l -v"
  • Output of non-interactive vs interactive "command -v codex/node"

Additional information

No response

Irving798 avatar Nov 10 '26 07:11 Irving798

I can confirm the bundled-Linux-runtime option you asked about on a later build. On Windows desktop 26.1117.31558 (MSIX 26.1117.3838.0), my Ubuntu connection worked without a separate npm installation of Codex. Inside Ubuntu the desktop-managed executable was ~/.local/share/codex/desktop-cli/public/current/codex, and its CLI version was 0.171.0-alpha.13.

If you retest on a newer desktop build, this checks that exact executable inside the affected distro, independently of the interactive shell’s PATH:

runtime="$HOME/.local/share/codex/desktop-cli/public/current/codex"
if [ -x "$runtime" ]; then
  "$runtime" --version
fi

If that prints a version while the desktop launch log for the same distro still names the shim under /mnt/c/, that isolates executable selection without changing Node, nvm, or /usr/local/bin. I haven’t verified that 26.1103.7773.0 shipped that path or that updating fixes the resolver in your setup.

rbnrong avatar Nov 20 '26 21:11 rbnrong