Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

carlosanjos's avatar

Docker Image with Wayfinder

I'm trying to create a Docker image using the latest Laravel version with the starter kit React + Laravel's built-in authentication + Pest.

My image has 3 stages. The first building assets, the second running composer install, and the last one building the app.

I know Wayfinder needs PHP to run scripts, but I don't get why I need to install PHP's dev libraries.

RUN composer install --no-dev --optimize-autoloader --no-scripts works fine, but I expect RUN composer install --optimize-autoloader --no-scripts to work as well, given Wayfinder is part of the composer.json required libraries.

The error below happens when I run bun run build

0.835 [@laravel/vite-plugin-wayfinder] [plugin @laravel/vite-plugin-wayfinder] Error generating types: Error: Command failed: php artisan wayfinder:generate --with-form
0.835     at getRollupError (/app/node_modules/rollup/dist/es/shared/parseAst.js:401:45)
0.835     at error (/app/node_modules/rollup/dist/es/shared/parseAst.js:397:42)
0.835     at <anonymous> (/app/node_modules/@laravel/vite-plugin-wayfinder/dist/index.mjs:2101:15)
0.835     at processTicksAndRejections (native:7:39)
0.840 error: script "build" exited with code 1```
1 like
2 replies
xrddr's avatar

Installing PHP and Node in a single Docker container helped me.

1 like
bwjoyce's avatar

A similar error happened to me when I did not have the storage/framework directories present.

Running APP_DEBUG=true php artisan wayfinder:generate --with-form -vvv helped me see the following error: [InvalidArgumentException] Please provide a valid cache path

In my case, updating .dockerignore fixed the problem.

Please or to participate in this conversation.