Skip to content

Unexpected token import #321

Closed
Closed

Description

@janisz

What version of Codex is running?

latest

Which model were you using?

No response

What platform is your computer?

Linux 6.0.18-060018-generic x86_64 x86_64

What steps can reproduce the bug?

$ codex
/usr/lib/node_modules/@openai/codex/dist/cli.js:2
var Zpe=Object.create;var mD=Object.defineProperty;var e1e=Object.getOwnPropertyDescriptor;var t1e=Object.getOwnPropertyNames;var r1e=Object.getPrototypeOf,n1e=Object.prototype.hasOwnProperty;var lr=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var il=(e,t)=>()=>(e&&(t=e(e=0)),t);var Q=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),gD=(e,t)=>{for(var r in t)mD(e,r,{get:t[r],enumerable:!0})},a1e=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of t1e(t))!n1e.call(e,a)&&a!==r&&mD(e,a,{get:()=>t[a],enumerable:!(n=e1e(t,a))||n.enumerable});return e};var Le=(e,t,r)=>(r=e!=null?Zpe(r1e(e)):{},a1e(t||!e||!e.__esModule?mD(r,"default",{value:e,enumerable:!0}):r,e));import{createRequire as i1e}from"module";var g=il(()=>{"use strict";globalThis.re

SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3

What is the expected behavior?

It works

What do you see instead?

No response

Additional information

No response

Activity

  1. added
    bug
    on Apr 18, 2025
  2. ZaidPathan commented on Apr 19, 2025

    @ZaidPathan

    Any solution here? Not able to run codex. Installed using npm i -g, added OpenAI Key in .zshrc.

    Error:

    SyntaxError: Unexpected token '||='
        at Loader.moduleStrategy (internal/modules/esm/translators.js:145:18)
        at async link (internal/modules/esm/module_job.js:67:21)
    

    Update:
    Looks like Node v22+ is required.

  3. codex-maintainers commented on Aug 7, 2025

    @codex-maintainers

    Thank you for the feedback! Please try running the latest version of Codex CLI. If the issue persists, let us know.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions