Skip to content

npm install -g @openai/codex@latest broken on Windows after dist-tag packaging change (#11339) #11744

Closed

Description

@Balaxxe

What version of Codex CLI is running?

0.101.0

What subscription do you have?

Pro

Which model were you using?

Any

What platform is your computer?

Windows 11 Pro

What terminal emulator and version are you using (if applicable)?

PowerShell

What issue are you seeing?

Title: npm install -g @openai/codex@latest broken on Windows after dist-tag packaging change (#11339)

Key details to include:

  • Worked on 0.99.x, broke on 0.100.0 and still broken on 0.101.0
  • @openai/codex-win32-x64 returns 404 on npm registry
  • Error: Missing optional dependency @openai/codex-win32-x64
  • Workaround: downloading native binary from GitHub releases
  • Platform: Windows x64, Node v22.15.0

What steps can reproduce the bug?

Here's what to paste in each field:

What steps can reproduce the bug?

1. On Windows x64, run: `npm install -g @openai/codex@latest`
2. Run: `codex`

Error:

Error: Missing optional dependency @openai/codex-win32-x64. Reinstall Codex: npm install -g @openai/codex@latest


3. Attempting to install the dependency directly returns 404:

npm install -g @openai/codex-win32-x64
npm error 404 Not Found - GET https://registry.npmjs.org/@openai%2fcodex-win32-x64 - Not found


The package `@openai/codex-win32-x64` does not exist on the npm registry. This regression was introduced in 0.100.0 by #11339, which switched from bundling platform binaries to distributing them via dist-tags. Previous versions (0.99.x and earlier) worked fine.

- Platform: Windows x64
- Node: v22.15.0
- Codex versions affected: 0.100.0, 0.101.0

Workaround: Download the native binary (`codex-x86_64-pc-windows-msvc.exe`) from GitHub releases and place it on PATH manually, then delete the `.ps1`, `.cmd`, and extensionless wrappers npm creates.

What is the expected behavior?

`npm install -g @openai/codex@latest` should install successfully and `codex` should launch on Windows x64 without requiring manual binary downloads, as it did in 0.99.x and earlier.

Additional information

No response

Activity

  1. added
    bug
    on Feb 13, 2026
  2. added
    CLI
    windows-os
    on Feb 13, 2026
  3. LiwojLS commented on Feb 19, 2026

    @LiwojLS

    This is still a problem even with 0.104.0

    - @openai/codex 0.99.0
    + @openai/codex 0.104.0
    
    Done in 4.5s using pnpm v10.30.0
     BSRS  codex
    file:///C:/Users/micha/AppData/Local/pnpm/global/5/.pnpm/@[email protected]/node_modules/@openai/codex/bin/codex.js:100
        throw new Error(
              ^
    
    Error: Missing optional dependency @openai/codex-win32-x64. Reinstall Codex: npm install -g @openai/codex@latest
        at file:///C:/Users/micha/AppData/Local/pnpm/global/5/.pnpm/@[email protected]/node_modules/@openai/codex/bin/codex.js:100:11
        at ModuleJob.run (internal/modules/esm/module_job.js:183:25)
        at async Loader.import (internal/modules/esm/loader.js:178:24)
        at async Object.loadESM (internal/process/esm_loader.js:68:5)
        at async handleMainPromise (internal/modules/run_main.js:59:12)
    
  4. etraut-openai commented on Feb 19, 2026

    @etraut-openai
    Contributor

    Please refer to this troubleshooting documentation. Let us know if that addresses the problem you're seeing.

  5. LiwojLS commented on Feb 20, 2026

    @LiwojLS

    @etraut-openai Thanks for pointing me out. I had C++ build tools installed. However, the issue was the installation was triggered when an ancient version of Node was active on my machine (nvm). After uninstalling Codex, switching to Node 22 and installing 0.104.0 again, everything works fine now.

    Thank you

  6. sextoncapital commented on Feb 26, 2026

    @sextoncapital

    having this problem too, quite annoying

  7. ChenZ2000 commented on Feb 26, 2026

    @ChenZ2000

    Same here after update 0.104-0.105.

  8. ChenZ2000 commented on Feb 26, 2026

    @ChenZ2000

    file:///C:/Users/sunsh/AppData/Roaming/npm/node_modules/@openai/codex/bin/codex.js:100
    throw new Error(
    ^
    Error: Missing optional dependency @openai/codex-win32-x64. Reinstall Codex: npm install -g @openai/codex@latest
    at file:///C:/Users/sunsh/AppData/Roaming/npm/node_modules/@openai/codex/bin/codex.js:100:11
    at ModuleJob.run (node:internal/modules/esm/module_job:413:25)
    at async onImport.tracePromise.proto (node:internal/modules/esm/loader:654:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)
    Node.js v25.2.1

  9. ipfred commented on Mar 6, 2026

    @ipfred

    use this ok

    $v = npm view @openai/codex version
    npm install -g "@openai/codex@$v" "@openai/codex-win32-x64@npm:@openai/codex@$v-win32-x64"

  10. bruce0817kr commented on Mar 10, 2026

    @bruce0817kr

    Workaround without downloading GitHub binary

    Found another workaround that works purely via npm (no manual binary download needed).

    The issue is that npm doesn't resolve the npm: alias in optionalDependencies when doing a global install. Installing the platform-specific package explicitly using the alias syntax fixes it:

    Step 1: Install the main package normally:

    npm install -g @openai/codex

    Step 2: Manually install the Windows binary using the npm alias syntax:

    npm install -g "@openai/codex-win32-x64@npm:@openai/[email protected]"

    Replace 0.113.0 with whatever version was installed in step 1.

    Verification:

    $ codex --version
    codex-cli 0.113.0
    

    This works on Windows x64 with Node v24.13.0 and npm v11.10.0 (MSYS2/Git Bash).

    Root cause: npm fails to install optionalDependencies that use npm: alias format (e.g. "@openai/codex-win32-x64": "npm:@openai/[email protected]") during global installs. The package @openai/codex-win32-x64 literally doesn't exist on the registry — only @openai/codex@{version}-win32-x64 does — so npm returns 404 and silently skips it.

  11. Yazan4m7 commented on Mar 15, 2026

    @Yazan4m7

    Confirm this worked (after 3 days of trying) :

    $v = npm view @openai/codex version
    npm install -g "@openai/codex@$v" "@openai/codex-win32-x64@npm:@openai/codex@$v-win32-x64"
    
  12. sextoncapital commented on Mar 15, 2026

    @sextoncapital
  13. roryeckel commented on Mar 19, 2026

    @roryeckel

    The solution above #11744 (comment) was just recommended to me by ChatGPT, and it worked!

  14. dandan1232 commented on Mar 30, 2026

    @dandan1232

    if you use bash/WSL,try this:
    v=$(npm view @openai/codex version)
    npm install -g "@openai/codex@$v" "@openai/codex-linux-x64@npm:@openai/codex@$v-linux-x64"

    Image
  15. removed
    windows-os
    on Apr 2, 2026
  16. wardbit commented on Apr 3, 2026

    @wardbit

    Workaround without downloading GitHub binary

    无需下载 GitHub 二进制文件的解决方法
    Found another workaround that works purely via npm (no manual binary download needed).找到了另一种完全通过 npm 运行的解决方法(无需手动下载二进制文件)。

    The issue is that npm doesn't resolve the npm: alias in optionalDependencies when doing a global install. Installing the platform-specific package explicitly using the alias syntax fixes it:问题在于,在进行全局安装时,npm 无法在 optionalDependencies 中解析 npm: 的别名。使用别名语法显式安装特定平台的软件包就能解决这个问题:

    Step 1: Install the main package normally:步骤 1:正常安装主软件包:

    npm install -g @openai/codex
    Step 2: Manually install the Windows binary using the npm alias syntax:第 2 步:使用 npm 别名语法手动安装 Windows 二进制文件:

    npm install -g "@openai/codex-win32-x64@npm:@openai/[email protected]"
    Replace 0.113.0 with whatever version was installed in step 1.将 0.113.0 替换为步骤 1 中安装的版本。

    Verification:  验证:

    $ codex --version
    codex-cli 0.113.0
    

    This works on Windows x64 with Node v24.13.0 and npm v11.10.0 (MSYS2/Git Bash).该功能可在 Windows x64 上使用 Node v24.13.0 和 npm v11.10.0 (MSYS2/Git Bash) 运行。

    Root cause: npm fails to install optionalDependencies that use npm: alias format (e.g. "@openai/codex-win32-x64": "npm:@openai/[email protected]") during global installs. The package @openai/codex-win32-x64 literally doesn't exist on the registry — only @openai/codex@{version}-win32-x64 does — so npm returns 404 and silently skips it.根本原因:在全局安装过程中,npm 无法安装使用 npm: 别名格式的 optionalDependencies (例如 "@openai/codex-win32-x64": "npm:@openai/[email protected]" )。注册表中并不存在 @openai/codex-win32-x64 软件包,只有 @openai/codex@{version}-win32-x64 存在,因此 npm 返回 404 并静默地跳过它。
    it's work for me

  17. sprainJinyu commented on May 17, 2026

    @sprainJinyu
    Image

    成功了,感谢:
    #11744 (comment)

  18. aspirantzhang commented on May 27, 2026

    @aspirantzhang

    It's important for Chinese users to include the --registry=https://registry.npmjs.org/ argument when running the install command.

    This is because we often use a custom npm source, https://registry.npmmirror.com, which may not work correctly in this case.

    So the full commands would be:

    v=$(npm view @openai/codex version)
    npm install -g "@openai/codex@$v" "@openai/codex-linux-x64@npm:@openai/codex@$v-linux-x64" --registry=https://registry.npmjs.org/
    

    I tested it with Codex v0.134.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions