Skip to content

Windows: node.exe works, but any Node JS script crashes Codex with ncrypto::CSPRNG(nullptr, 0) #17451

@BjtuCivil

Description

@BjtuCivil

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

OpenAI.Codex_26.409.1734.0_x64__2p2nqsd0c76g0

What subscription do you have?

gpt5.4

What platform is your computer?

Microsoft Windows NT 10.0.22000.0 x64

What issue are you seeing?

Inside Codex desktop on Windows, Node itself is discoverable and node --version works, but any command that requires executing a Node JS script fails.

What works:

  • where node -> D:\Software\nodejs\node.exe
  • where npm -> D:\Software\nodejs\npm and D:\Software\nodejs\npm.cmd
  • node --version -> v24.14.0

What fails inside Codex:

  • npm --version
  • D:\Software\nodejs\npm.cmd --version
  • D:\Software\nodejs\node.exe -e "console.log('ok')"
  • D:\Software\nodejs\node.exe D:\Software\nodejs\node_modules\npm\bin\npm-cli.js --version

Observed errors:

  • Could not determine Node.js install directory
  • Assertion failed: ncrypto::CSPRNG(nullptr, 0)

Stack trace points into:

  • C:\Program Files\WindowsApps\OpenAI.Codex_26.409.1734.0_x64__2p2nqsd0c76g0\app\resources\codex.exe

One representative error:

Could not determine Node.js install directory

#  C:\Program Files\WindowsApps\OpenAI.Codex_26.409.1734.0_x64__2p2nqsd0c76g0\app\resources\codex.exe[44628]: std::shared_ptr<InitializationResultImpl> __cdecl node::InitializeOncePerProcessInternal(const std::vector<std::string> &, ProcessInitializationFlags::Flags) at src\node.cc:1221
#  Assertion failed: ncrypto::CSPRNG(nullptr, 0)

----- Native stack trace -----

1: 00007FF69AC1B9FA EVP_MD_meth_get_input_blocksize+196154
2: 00007FF69AC75D26 node::InitializeOncePerProcess+2790
3: 00007FF69AC76E0C node::Start+156
4: 00007FF69BC93F82 AES_cbc_encrypt+2546
5: 00007FF69CB071F4 v8::base::UnsignedDivisionByConstant<unsigned __int64>+2830084
6: 00007FFCE84C53E0 BaseThreadInitThunk+16
7: 00007FFCEA60485B RtlUserThreadStart+43

Important detail:

  • The same Node/npm commands work normally outside Codex in a regular terminal.
  • So this appears to be a Codex-on-Windows issue affecting Node JS script execution, not a broken Node installation or PATH issue.

What steps can reproduce the bug?

Use a Windows Codex desktop session with Node installed and available on PATH.

Repro steps:

  1. Open Codex desktop on Windows 11.
  2. Open a terminal in any workspace.
  3. Run:
where node
where npm
node --version
npm --version
  1. Confirm that:
    • where node resolves correctly, for example D:\Software\nodejs\node.exe
    • where npm resolves correctly, for example D:\Software\nodejs\npm and D:\Software\nodejs\npm.cmd
    • node --version succeeds, for example v24.14.0
  2. Then run either of these:
npm --version

or

D:\Software\nodejs\node.exe -e "console.log('ok')"

or

D:\Software\nodejs\node.exe D:\Software\nodejs\node_modules\npm\bin\npm-cli.js --version

Expected result:

  • npm --version should print the npm version.
  • node.exe -e "console.log('ok')" should print ok.

Actual result:

  • Any command that requires Node to execute a JS script fails inside Codex.
  • Typical error:
Could not determine Node.js install directory
Assertion failed: ncrypto::CSPRNG(nullptr, 0)
  • Stack trace points into:
C:\Program Files\WindowsApps\OpenAI.Codex_26.409.1734.0_x64__2p2nqsd0c76g0\app\resources\codex.exe

Minimal repro snippet:

node --version
D:\Software\nodejs\node.exe -e "console.log('ok')"

Observed behavior from that minimal repro:

  • First command succeeds
  • Second command fails inside Codex, but works in a normal external terminal

Notes:

  • This does not appear to be a PATH issue.
  • node and npm are discoverable with where.
  • The same commands work outside Codex in a regular Windows terminal.
  • The failure seems specific to Node JS script execution inside Codex.

What is the expected behavior?

Expected behavior:

  • Codex on Windows should execute Node-based commands the same way a normal terminal does.
  • If node and npm are on PATH, these commands should work inside Codex:
node --version
npm --version
D:\Software\nodejs\npm.cmd --version
D:\Software\nodejs\node.exe -e "console.log('ok')"
D:\Software\nodejs\node.exe D:\Software\nodejs\node_modules\npm\bin\npm-cli.js --version

Expected outputs:

  • node --version prints the installed Node version
  • npm --version prints the installed npm version
  • node.exe -e "console.log('ok')" prints ok
  • Direct execution of npm-cli.js also works

In short:

  • Codex should be able to launch node.exe and execute JS entrypoints without crashing or rerouting into a failing Codex runtime path.
  • Node-based developer workflows such as npm, eslint, vite, and project build/lint commands should work normally inside Codex.

Additional information

Additional information:

This issue appears specific to Codex on Windows, not to the local Node.js installation.
Node and npm work correctly in a normal external terminal on the same machine.
Inside Codex, where node and where npm resolve correctly, and node --version works.
The failure starts when Node is asked to execute a JS script.
This affects Node-based tooling broadly, not just npm, so it likely impacts workflows involving eslint, vite, and other JS-based CLIs.
In the Codex shell environment, %APPDATA% also appeared abnormal during testing, which may be related, but explicitly setting APPDATA and LOCALAPPDATA did not resolve the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtool-callsIssues related to tool callingwindows-osIssues related to Codex on Windows systems

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions