Build failure due to missing package-lock.json using provided nix flake

Resolved 💬 4 comments Opened Apr 22, 2025 by daniels Closed Aug 7, 2025
💡 Likely answer: A maintainer (benny123tw, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

3eba86a

Which model were you using?

_No response_

What platform is your computer?

Darwin 23.6.0 arm64 arm

What steps can reproduce the bug?

  1. Install nix and enable experimental features nix-command and flakes.
  2. Run: nix build github:openai/codex

What is the expected behavior?

The flake is built in the nix store and symlinked under result in the current directory.

What do you see instead?

❯ nix build github:openai/codex
error: builder for '/nix/store/33mk8p1qhm97ds6r7nybkgrq0sd6r12c-codex-cli-0.1.0-npm-deps.drv' failed with exit code 1;
last 16 log lines:
> Running phase: unpackPhase
> unpacking source archive /nix/store/5ardzwg23q72143glb3r2v0gfp0hapjn-source/codex-cli
> source root is codex-cli
> Running phase: patchPhase
> Running phase: updateAutotoolsGnuConfigScriptsPhase
> Running phase: configurePhase
> no configure script, doing nothing
> Running phase: buildPhase
>
> ERROR: The package-lock.json file does not exist!
>
> package-lock.json is required to make sure that npmDepsHash doesn't change
> when packages are updated on npm.
>
> Hint: You can copy a vendored package-lock.json file via postPatch.
>
For full logs, run 'nix log /nix/store/33mk8p1qhm97ds6r7nybkgrq0sd6r12c-codex-cli-0.1.0-npm-deps.drv'.
error: 1 dependencies of derivation '/nix/store/4f8jzfmvwlmh2pnrxinw997mkz86zk4l-codex-cli-0.1.0.drv' failed to build

Additional information

Very happy to see the ambition for nix/flake support.

View original on GitHub ↗

4 Comments

benny123tw contributor · 1 year ago

I don't use nix, but maybe the error is because we migrated to pnpm (https://github.com/openai/codex/pull/287)? Maybe we should update the build script in the nix file.

peteringram0 · 1 year ago

Also seeing this issue:

building the system configuration...
warning: Git tree '/Users/peteringram/Code/nix' is dirty
error: builder for '/nix/store/zmb3ndza72mg8z48azcj84rasjigwhjk-codex-cli-0.1.0-npm-deps.drv' failed with exit code 1;
       last 16 log lines:
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/9b6z6x4bc106ljf43yrqvpy85x9sdng0-source/codex-cli
       > source root is codex-cli
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > no configure script, doing nothing
       > Running phase: buildPhase
       >
       > ERROR: The package-lock.json file does not exist!
       >
       > package-lock.json is required to make sure that npmDepsHash doesn't change
       > when packages are updated on npm.
       >
       > Hint: You can copy a vendored package-lock.json file via postPatch.
       >
       For full logs, run 'nix-store -l /nix/store/zmb3ndza72mg8z48azcj84rasjigwhjk-codex-cli-0.1.0-npm-deps.drv'.
error: 1 dependencies of derivation '/nix/store/41yqa2ilwrk4r40w8yzznz4ylx6a585v-codex-cli-0.1.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/srsnrrj179p6f2qv7msdmqr7hyr35mhw-home-manager-applications.drv' failed to build
error: 1 dependencies of derivation '/nix/store/31v0x84ffni7c12vkjvm1xrqmy27f7a0-home-manager-fonts.drv' failed to build
error: 1 dependencies of derivation '/nix/store/qqi7ldm0d2h9djjvkhbgj6fpmsrz5p3z-home-manager-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/km3w1ys3l340xvr7hdn6jc7nkq7qg6x2-home-manager-generation.drv' failed to build
error: 1 dependencies of derivation '/nix/store/sfjv51a884gn1rj4szmqj6a306c8zfg7-user-environment.drv' failed to build
error: 1 dependencies of derivation '/nix/store/bpds0j9bvsl01b8s0pjqhdky8vyg546g-activation-peteringram.drv' failed to build
error: 1 dependencies of derivation '/nix/store/bykai7sgs47wf7hdmqwyqkai9lgavh3y-darwin-system-24.11.fc84389.drv' failed to build

@benny123tw this would cause this but you will need to bring in the pnpm dependency: https://github.com/openai/codex/blob/main/flake.nix#L38

Related to: https://github.com/openai/codex/issues/241

eranknafo2001 · 1 year ago

any update on this issue?

codex-maintainers · 1 year ago

Thanks for the feedback! Please try again on the latest version of Codex CLI. We're currently focused on the native/Rust implementation, and we'd love to see if this issue persists there. If it does, let us know!