railwayapp / nixpacks

App source + Nix packages + Docker = Image
https://nixpacks.com
MIT License
2.33k stars 222 forks source link

error: undefined variable 'pnpm-8_x' #1059

Open baptisteArno opened 5 months ago

baptisteArno commented 5 months ago

Is there an existing issue for this?

Describe the bug

When trying to build my app, it quickly fails with the following error:

╔═══════════════ Nixpacks v1.21.0 ═══════════════╗
║ setup      │ bun, nodejs_18, pnpm-8_x, openssl ║
║────────────────────────────────────────────────║
║ install    │ pnpm install                      ║
║────────────────────────────────────────────────║
║ build      │ pnpm run build:chat-api           ║
║────────────────────────────────────────────────║
║ start      │ pnpm run start:chat-api           ║
╚════════════════════════════════════════════════╝

[+] Building 23.0s (8/14)                                                                                                                   
 => [internal] load build definition from Dockerfile                                                                                   0.1s
 => => transferring dockerfile: 1.44kB                                                                                                 0.0s
 => [internal] load .dockerignore                                                                                                      0.1s
 => => transferring context: 189B                                                                                                      0.0s
 => [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1705968199                                                         1.8s
 => [internal] load build context                                                                                                      5.0s
 => => transferring context: 89.22MB                                                                                                   5.0s
 => [stage-0  1/10] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1705968199@sha256:a2eb89dbff162b441c194e6281fc5c32b08d0ce4c91cae214b98615  7.0s
 => => resolve ghcr.io/railwayapp/nixpacks:ubuntu-1705968199@sha256:a2eb89dbff162b441c194e6281fc5c32b08d0ce4c91cae214b9861585025dfb9   0.0s
 => => sha256:ce9ebea987c26664d067f7e14c93231c6d303e4acb322f15ddbf05b414646d64 27.36MB / 27.36MB                                       2.0s
 => => sha256:2f96aba9f97cbf2bf3d0ba84aa03bf40073a88276eeb299f88f9f376d9443bdc 31.83MB / 31.83MB                                       2.1s
 => => sha256:ffc443aa4cd5214ac5167a8cc46727e95da2b0a3fbf80635495406b927ffcd19 32.42MB / 32.42MB                                       1.8s
 => => sha256:a2eb89dbff162b441c194e6281fc5c32b08d0ce4c91cae214b9861585025dfb9 1.61kB / 1.61kB                                         0.0s
 => => sha256:77b065f7f602158b2c2e1a2c7f9e1bdc6e1e49f55ce622c3606230ebefe4a865 868B / 868B                                             0.0s
 => => sha256:dfe8c76df73e1fba5b1eef26bd1f632ba8782591688d38912b156aa326b5f90d 4.39kB / 4.39kB                                         0.0s
 => => extracting sha256:ce9ebea987c26664d067f7e14c93231c6d303e4acb322f15ddbf05b414646d64                                              1.7s
 => => extracting sha256:2f96aba9f97cbf2bf3d0ba84aa03bf40073a88276eeb299f88f9f376d9443bdc                                              1.5s
 => => extracting sha256:ffc443aa4cd5214ac5167a8cc46727e95da2b0a3fbf80635495406b927ffcd19                                              1.0s
 => [stage-0  2/10] WORKDIR /app/                                                                                                      0.3s
 => [stage-0  3/10] COPY .nixpacks/nixpkgs-bf744fe90419885eefced41b3e5ae442d732712d.nix .nixpacks/nixpkgs-bf744fe90419885eefced41b3e5  0.0s
 => ERROR [stage-0  4/10] RUN nix-env -if .nixpacks/nixpkgs-bf744fe90419885eefced41b3e5ae442d732712d.nix && nix-collect-garbage -d    13.8s
------                                                                                                                                      
 > [stage-0  4/10] RUN nix-env -if .nixpacks/nixpkgs-bf744fe90419885eefced41b3e5ae442d732712d.nix && nix-collect-garbage -d:                
#8 12.92 installing 'bf744fe90419885eefced41b3e5ae442d732712d-env'                                                                          
#8 13.16 error:                                                                                                                             
#8 13.16        … while calling the 'derivationStrict' builtin                                                                              
#8 13.16                                                                                                                                    
#8 13.16          at /derivation-internal.nix:9:12:
#8 13.16 
#8 13.16             8|
#8 13.16             9|   strict = derivationStrict drvAttrs;
#8 13.16              |            ^
#8 13.16            10|
#8 13.16 
#8 13.16        … while evaluating derivation 'bf744fe90419885eefced41b3e5ae442d732712d-env'
#8 13.16          whose name attribute is located at /nix/store/hw0mp7awqma06m6s2h9yckyccxb63nqx-source/pkgs/stdenv/generic/make-derivation.nix:348:7
#8 13.16 
#8 13.16        … while evaluating attribute 'passAsFile' of derivation 'bf744fe90419885eefced41b3e5ae442d732712d-env'
#8 13.16 
#8 13.16          at /nix/store/hw0mp7awqma06m6s2h9yckyccxb63nqx-source/pkgs/build-support/trivial-builders/default.nix:88:7:
#8 13.16 
#8 13.16            87|       inherit buildCommand name;
#8 13.16            88|       passAsFile = [ "buildCommand" ]
#8 13.16              |       ^
#8 13.16            89|         ++ (derivationArgs.passAsFile or []);
#8 13.16 
#8 13.16        error: undefined variable 'pnpm-8_x'
#8 13.16 
#8 13.16        at /app/.nixpacks/nixpkgs-bf744fe90419885eefced41b3e5ae442d732712d.nix:19:31:
#8 13.16 
#8 13.16            18|         '')
#8 13.16            19|         bun nodejs_18 openssl pnpm-8_x
#8 13.16              |                               ^
#8 13.16            20|       ];
------
executor failed running [/bin/bash -ol pipefail -c nix-env -if .nixpacks/nixpkgs-bf744fe90419885eefced41b3e5ae442d732712d.nix && nix-collect-garbage -d]: exit code: 1
Error: Docker build failed

To reproduce

  1. Clone this repo: https://github.com/baptisteArno/typebot.io
  2. Run this command
    nixpacks build . --name typebot-chat-api --pkgs bun --build-cmd "pnpm run build:chat-api" --start-cmd "pnpm run start:chat-api" --install-cmd "pnpm install"

Expected behavior

Should build

Environment

MacOS 14.3 Nixpacks v1.21.0

baptisteArno commented 5 months ago

Running the command: nixpacks build . --name typebot-chat-api

With that config:

[phases.setup]
nixPkgs = ["bun", "pnpm-8_x", "openssl", "nodejs_18"]

[phases.install]
cmds = ["pnpm install"]

[phases.build]
cmds = ["pnpm run build:chat-api"]

[start]
cmd = "pnpm run start:chat-api"

Fixes the issue, though I don't understand why