#Error ''attribute 'json' missing'' while building PHP application

3 messages · Page 1 of 1 (latest)

verbal sentinel
#

Hello,

While trying to setup a deployment workflow for my PHP application with Railway.app for the first time, I got this error after it start building.

Full logs :

║──────────────────────────────────────────────────────────────────────────────║
║ Install    │ mkdir -p /var/log/nginx && mkdir -p /var/cache/nginx            ║
║            │ composer install                                                ║
║            │ npm ci                                                          ║
║──────────────────────────────────────────────────────────────────────────────║
║ Build      │ npm run prod                                                    ║
║──────────────────────────────────────────────────────────────────────────────║
║ Start      │ ([ -e /app/storage ] && chmod -R ugo+w /app/storage); perl      ║
║            │ /assets/transform-config.pl /assets/nginx.template.conf         ║
║            │ /nginx.conf && echo "Server starting on port $PORT" && (php-fpm ║
║            │ -y /assets/php-fpm.conf & nginx -c /nginx.conf)                 ║
╚══════════════════════════════════════════════════════════════════════════════╝
 
 
#1 [internal] load build definition from Dockerfile
#1 sha256:e2a8aa06f09a5a7cd5579e26e8165011490dbc3c886fbe6cb23c3f6be4a5694f
#1 transferring dockerfile: 1.60kB done
#1 DONE 0.1s
 
#2 [internal] load .dockerignore
#2 sha256:4540e29eebd6dcc6dc76a291d5f47a9001e9251eb9be95675374393ad1ace967
#2 transferring context: 2B done
 
#2 DONE 0.1s
 
#3 [internal] load metadata for ghcr.io/railwayapp/nixpacks:debian-1661888972
#3 sha256:9f3d2012f905fbc5aaf8b4899f00c404dde891ef37a60c22ea0c065721fb21c2
 
#3 DONE 0.2s
 
 
#4 [stage-0  1/10] FROM ghcr.io/railwayapp/nixpacks:debian-1661888972@sha256:a4bb1fb72e58f4e1fc4673c27459af71d454b401de2b67e6fa974e75d12abd37
#4 sha256:adc75607bb80c87750720a9999693c8f47eecc80ab525625f738198bdd3bc1bb
#4 DONE 0.0s
 
#5 [stage-0  2/10] WORKDIR /app/
#5 sha256:cc836cd4b3e64ab77823a6d2d600f52876679c988fd232f60ed77b7a039dbe14
#5 CACHED
 
#6 [internal] load build context
#6 sha256:f2c5ba2ffd98a3c142d0375366fd6fc62420cb20b3f624032a2f786a57bb3233
#6 transferring context: 3.37MB 0.1s done
#6 DONE 0.1s
 
 
#7 [ 3/11] COPY .nixpacks/assets /assets/
#7 sha256:097403ab0c6e20107f9c333e9f8852118972cb734d17cb48b8e16270d0bb0bf1
#7 CACHED
 
#8 [ 4/11] COPY .nixpacks/setup.nix .nixpacks/setup.nix
#8 sha256:cb5bdb8f08570d60f090d33d1d2427ece42c8565524c829d4cea43eb2814519f
#8 DONE 0.1s
 
 
#9 [ 5/11] RUN nix-env -if .nixpacks/setup.nix
#9 sha256:b413c69499efce2b4ac0e7c59c576a13469d59071b1a8c2464fdad7094d3f2ec
 
#9 1.001 installing 'setup-env'
 
#9 2.749 error: attribute 'json' missing
#9 2.749
#9 2.749        at /app/.nixpacks/setup.nix:19:49:
#9 2.749
#9 2.749            18|         '')
#9 2.749            19|         php80 perl nginx php80Packages.composer php80Extensions.json php80Extensions.zip nodejs-16_x npm-8_x
#9 2.749              |                                                 ^
#9 2.749            20|       ];
#9 2.749 (use '--show-trace' to show detailed location information)
 
#9 ERROR: executor failed running [/bin/bash -ol pipefail -c nix-env -if .nixpacks/setup.nix]: exit code: 1
-----
> [ 5/11] RUN nix-env -if .nixpacks/setup.nix:
-----
executor failed running [/bin/bash -ol pipefail -c nix-env -if .nixpacks/setup.nix]: exit code: 1
 
Error: Docker build failed
bronze moat
#

Same issue for me, is there a solution ?
Maybe set PHP version to 8.1 in composer.json and see if it works better ? ^^"

grim bane
#

Likely a PHP version issue. Try 8.1