1
votes

I installed Laravel using composer on my local machine and created a projet.

laravel new whatever
cd whatever
npm install
npm run watch

The page renders correctly. After installing auth by using :

php artisan make:auth

I obtain the two buttons to login and register. When I try visiting those links, the css and js doesn't render. I get 404 not found for app.css and app.js.

Here is my webpack.mix.js :

let mix = require('laravel-mix');

mix.js('resources/assets/js/app.js', 'public/js')
 .sass('resources/assets/sass/app.scss', 'public/css');

Here is the inclusions in app.blade.php (css in head, script at the end of body)

<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<script src="{{ asset('/js/app.js') }}"></script>

I tried doing this using xampp, wamp, always referencing the php and mysql in my global variables.

I'm using php artisan serve.

2

2 Answers

0
votes

I managed to make it work by placing my laravel project in my wamp/www folder. Very strange cause I'm using php artisan serve and my wamp isn't even started.

0
votes

I had the same problem. But this solution worked for me:

  1. npm install

    // This line will install all the dependencies

  2. npm run watch

    // After applying this command both files become visible.

    // App.css A & app.js