codex CLI crashes in Node.js 20+ due to read-only process.noDeprecation assignment

Resolved 💬 3 comments Opened Apr 18, 2025 by Hitman247m Closed Apr 18, 2025
💡 Likely answer: A maintainer (jonchurch, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.1.2504172351

Which model were you using?

N/A

What platform is your computer?

Darwin 24.4.0 arm64 arm

What steps can reproduce the bug?

Environment:

  • Node.js: v22.14.0 (LTS)
  • OS: macOS (Apple Silicon)
  • Codex CLI: latest (installed globally via npm)
  • Location: /opt/homebrew/lib/node_modules/@openai/codex/dist/cli.js

Issue:

Running any codex command fails with:

$ codex --version
file:///opt/homebrew/lib/node_modules/@openai/codex/dist/cli.js:675
`;let s=E=>{console.log(a),h7.exit(typeof E=="number"?E:2)},c=()=>{console.log(typeof e.version=="string"?e.version:r.version),h7.exit(0)};n._.length===0&&e.argv.length===1&&(n.version===!0&&e.autoVersion?c():n.help===!0&&e.autoHelp&&s(0));let d=n._;delete n._,e.allowUnknownFlags||uce(d);let f=dle(n,{exclude:["--",/^\w$/]}),A={...f};cce(f,e);for(let E of Object.values(e.flags)){if(Array.isArray(E.aliases))for(let C of E.aliases)delete f[C];delete f[E.shortFlag]}return dce(e.flags,f,d),{input:d,flags:f,unnormalizedFlags:A,pkg:r,help:a,showHelp:s,showVersion:c}},pce=(e,t={})=>{let r=oce(e,t),n=sce(r),a=CFe(r,n);return h7.title=a.pkg.bin?Object.keys(a.pkg.bin).at(0):a.pkg.name,a};var fce=Le(st(),1);import E7 from"path";process.noDeprecation=!0;Kb();var qa=pce(`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ^

TypeError: Cannot assign to read only property 'noDeprecation' of object '#<process>'
    at file:///opt/homebrew/lib/node_modules/@openai/codex/dist/cli.js:675:748

Node.js v22.14.0

What is the expected behavior?

_No response_

What do you see instead?

$ codex --version
file:///opt/homebrew/lib/node_modules/@openai/codex/dist/cli.js:675
`;let s=E=>{console.log(a),h7.exit(typeof E=="number"?E:2)},c=()=>{console.log(typeof e.version=="string"?e.version:r.version),h7.exit(0)};n._.length===0&&e.argv.length===1&&(n.version===!0&&e.autoVersion?c():n.help===!0&&e.autoHelp&&s(0));let d=n._;delete n._,e.allowUnknownFlags||uce(d);let f=dle(n,{exclude:["--",/^\w$/]}),A={...f};cce(f,e);for(let E of Object.values(e.flags)){if(Array.isArray(E.aliases))for(let C of E.aliases)delete f[C];delete f[E.shortFlag]}return dce(e.flags,f,d),{input:d,flags:f,unnormalizedFlags:A,pkg:r,help:a,showHelp:s,showVersion:c}},pce=(e,t={})=>{let r=oce(e,t),n=sce(r),a=CFe(r,n);return h7.title=a.pkg.bin?Object.keys(a.pkg.bin).at(0):a.pkg.name,a};var fce=Le(st(),1);import E7 from"path";process.noDeprecation=!0;Kb();var qa=pce(`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ^

TypeError: Cannot assign to read only property 'noDeprecation' of object '#<process>'
    at file:///opt/homebrew/lib/node_modules/@openai/codex/dist/cli.js:675:748

Node.js v22.14.0

Additional information

_No response_

View original on GitHub ↗

3 Comments

jonchurch contributor · 1 year ago

Ruh roh

I can't repro this even on node 22.14.0

~This smells like an ESM issue though, as process is possibly frozen in ESM context.~ More likely --frozen-intrinsics or another stricter policy is being set in your NODE_OPTIONS or system wide?

Im not sure why it is biting you here, it isnt biting me when built from source or installed from npm.

How did you install it? Which pacakge manager? Looks like npm, and you installed Node via brew it looks like?
Edit: I cant repro this when using node installed from homebrew either. To be clear, this is def a bug, and one that should get fixed, but I am seeking to understand how to repro this to evaluate blast radius and priority.

jonchurch contributor · 1 year ago

Can you check if your shell profile has NODE_OPTIONS already set?

echo "$NODE_OPTIONS"
Hitman247m · 1 year ago

@jonchurch Yup, that was it..

$ echo "$NODE_OPTIONS"
--no-deprecation --no-warnings

Unset that var:

$ unset NODE_OPTIONS

$ echo "$NODE_OPTIONS"

Now it's working:

$ codex --version
0.1.2504172351

Thanks for the quick response