I installed Laravel 5.4
in my server /public_html/laravel/
folder. When I access example.com/lavarel/public/
, it works.
I copied all my compiled files in my local public/
folder into the example.com/lavarel/public/
. Then I add the <script src="/js/app.js"></script>
into my welcome.blade.php
:
<!doctype html>
<html lang="{{ config('app.locale') }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>Laravel</title>
<!-- UIkit CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-beta.25/css/uikit.min.css" />
<!-- <link rel="stylesheet" href="assets/sass/uikit.css" /> -->
<!-- jQuery is required -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- UIkit JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-beta.25/js/uikit.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-beta.25/js/uikit-icons.min.js"></script>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
</head>
<body>
<div id="app" style="background:#666;height: 100vh;">
<router-view></router-view>
</div>
<script src="/js/app.js"></script>
</body>
</html>
But when I go to example.com/lavarel/public/
again, I got 404 error
:
GET example.com/js/app.js 404 (Not Found)
if I change to <script src="/laravel/public/js/app.js"></script>
, I will get another 404 error
:
GET example.com/laravel/public/laravel/public/js/app.js 404 (Not Found)
How can I resolve this?
I have same issue. It simply solved by running:npm run dev
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With