codex - 💡(How to fix) Fix Windows: node.exe works, but any Node JS script crashes Codex with ncrypto::CSPRNG(nullptr, 0) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#17451Fetched 2026-04-12 13:28:37
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×4unlabeled ×1

Error Message

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::vectorstd::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

Code Example

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

---

where node
where npm
node --version
npm --version

---

npm --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

---

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

---

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

---

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

---

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
RAW_BUFFERClick to expand / collapse

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.

extent analysis

TL;DR

The issue can be worked around by executing Node.js commands outside of the Codex environment or by troubleshooting the Codex configuration to ensure it properly handles Node.js script execution.

Guidance

  1. Verify Node.js installation: Confirm that Node.js is correctly installed and configured on the system by running node --version and npm --version in a normal terminal outside of Codex.
  2. Check Codex configuration: Investigate Codex settings or environment variables that might be interfering with Node.js script execution, such as PATH, APPDATA, or LOCALAPPDATA.
  3. Test with simple Node.js scripts: Try running simple Node.js scripts, like node -e "console.log('ok')" or node script.js, in both Codex and a normal terminal to isolate the issue.
  4. Compare environment variables: Compare the environment variables, especially those related to Node.js and Codex, between the Codex environment and a normal terminal to identify any discrepancies.

Example

No specific code snippet is provided as the issue seems related to the environment or configuration rather than a code problem.

Notes

The issue appears to be specific to the Codex environment on Windows and does not seem to be a problem with the Node.js installation itself, given that Node.js commands work correctly in a normal terminal.

Recommendation

Apply a workaround by executing Node.js commands and scripts outside of the Codex environment until the root cause of the issue within Codex is identified and resolved. This ensures that development workflows can continue uninterrupted.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING