Laravel 6.0.3 Not Loading Key Resources App.js or App.css 404 Not Found

Stefan Bogdanescu

Founder & Senior Architect · 2026-06-29

Laravel Company

Fixing 404 Errors in Laravel: Why Your app.js and app.css Are Missing After Scaffolding

As a senior developer, I’ve seen countless developers run into frustrating setup issues, especially when dealing with asset loading errors like 404 Not Found for files like app.js or app.css. This often happens right after using scaffolding tools or setting up a fresh Laravel project.

The scenario you described—running the initial commands and seeing 404 errors for your bundled JavaScript and CSS files, coupled with an empty public directory—is a very common symptom of a misconfigured asset compilation pipeline rather than a fundamental error in the core Laravel structure itself.

Let's dive into the technical reasons behind this problem and how to fix it correctly.

Understanding the Laravel Asset Pipeline

When you use tools like Laravel UI or modern frontend stacks with Laravel, the application doesn't just serve static files directly from the public folder. Instead, Laravel relies on a build process (using tools like Vite or Laravel Mix) to compile, minify, and bundle your source code (Sass, TypeScript, JavaScript).

The initial commands you ran:

laravel new cms
composer require laravel/ui
php artisan ui:auth
php artisan migrate

These commands set up the basic structure, create routes, and define views, but they do not automatically compile your frontend assets. The actual compiled files (app.js, app.css) are generated only after you run the asset compilation command.

Diagnosing the Missing Files

The reason you see 404 errors for /js/app.js and /css/app.css is that the web server is looking for these files in the public directory, but they do not exist there because the build step was skipped or failed.

Your observation that your public directory only contains .htaccess, index.php, favicon.ico, and robots.txt confirms this suspicion: the necessary compiled assets are missing from the root of the public folder.

The Solution: Running the Asset Compilation

To resolve this, you need to execute the command that actually compiles your frontend resources. In modern Laravel applications (especially those set up with scaffolding), this is typically handled by Vite or Mix.

Step 1: Install Dependencies (If necessary)

Ensure your project has the necessary front-end dependencies installed. This often involves installing Node.js packages and running the initial setup for your chosen build tool.

Step 2: Run the Build Command

Execute the command that triggers the compilation of all assets into the public directory. For projects using Vite (the default in newer Laravel installations), this is usually:

npm install  # Install Node dependencies if needed
npm run dev  # Or npm run build for production builds

This command reads your source files (like resources/js/app.js and resources/css/app.css), processes them through the compiler, and places the resulting optimized and bundled files into the public/build directory (or similar location, depending on your configuration).

Best Practices for Asset Management

When working with Laravel, it is crucial to understand that frontend assets are processed before they are served. This separation ensures that your application remains clean and maintainable. Always ensure you follow the official documentation provided by laravelcompany.com regarding asset bundling and configuration when setting up projects.

If you encounter further issues, double-check your vite.config.js or webpack.mix.js file to ensure the paths are correctly configured for asset output. A well-structured project relies on these build steps being executed consistently.

Conclusion

The 404 errors for app.js and app.css after initial setup are almost always a symptom of skipping the crucial asset compilation step. By ensuring you run your package manager commands (like npm run dev) to compile your frontend resources, you ensure that Laravel correctly generates all necessary files within the public directory, leading to a fully functional application. Happy coding!