I’m on Windows. I have a Laravel 6 / Vue 2 app, and it was working fine using XAMPP with php 7.4.29. (I am running mentioned projects with php artisan serve
)
I then wanted to run an open source project that is using Laravel 8. It didn’t work with php 7.4 and required me to use php >= 8.1. So I deleted the existing XAMPP folder, and installed XAMPP 8.2.12, and was able to get the OS project working.
I subsequently uninstalled XAMPP 8.2.12, and then extracted (from archive) the XAMPP/php 7.4.29 that I had used previously. Now, the Laravel 6 app is no longer working. (The Vue app doesn’t load).
So I created a test Laravel 6 / Vue 2 project from scratch, and it also is not working properly. The Laravel welcome page loads, however, the Vue object does not load, and also bootstrap does not load). So I added some test traces to try and see what is happening:
- In resources/js/app.js (the Vue app file) I added
console.log("special text");
- In publc/js, I added a file
myapp.js
which just callsconsole.log('my app');
. - I added a
test.blade.php
page (and route at/test
) which uses thelayoutsapp.blade.php
– where the Vue script is called.
So in app.blade.php, I have these lines:
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}" defer></script> // has trace: console.log("special text")
<script src="{{ asset('js/myapp.js') }}" defer></script> // has trace: console.log('my app')
When I load the test page (localhost:8000/test
), the console shows my app
, but not special text
.
Now comes the strange part. I look in the dev tools Network page. The app.js
and app.css
that are being served, have different sizes to those of the same name files in the public/js & public/css folders, and on inspection, I see that the contents are also different. They are the contents of this other project (Laravel 8), which is in a totally different path on Windows. (The app.css is using Tailwind css!!..) So it seems to me, that php artisan serve
, is somehow stuck on serving these other pages. I’ve tried calling php artisan cache:clear
, however that does not affect the problem.
As mentioned the Laravel 6 and Laravel 8 OS projects are in totally different folders on the PC.