首页 > 解决方案 > 在 laravel 中显示脚本加载失败的控制台

问题描述

问题(显示在控制台中)


GEThttp://127.0.0.1:8000/public/vuexy-assets/vendors/css/vendors.min.css
[HTTP/1.0 404 Not Found 580ms]

GEThttp://127.0.0.1:8000/public/vuexy-assets/css/bootstrap-extended.css
[HTTP/1.0 404 Not Found 1153ms]

GEThttp://127.0.0.1:8000/public/vuexy-assets/css/bootstrap.css
[HTTP/1.0 404 Not Found 885ms]

GEThttp://127.0.0.1:8000/public/vuexy-assets/css/core/menu/menu-types/vertical-menu.css
[HTTP/1.0 404 Not Found 2443ms]

GEThttp://127.0.0.1:8000/public/vuexy-assets/css/themes/semi-dark-layout.css
[HTTP/1.0 404 Not Found 2158ms]

GEThttp://127.0.0.1:8000/public/vuexy-assets/css/themes/dark-layout.css
[HTTP/1.0 404 Not Found 1917ms]

GEThttp://127.0.0.1:8000/public/vuexy-assets/css/components.css
[HTTP/1.0 404 Not Found 1664ms]

GEThttp://127.0.0.1:8000/public/vuexy-assets/css/colors.css
[HTTP/1.0 404 Not Found 1405ms]

GEThttp://127.0.0.1:8000/public/vuexy-assets/css/core/colors/palette-gradient.css
[HTTP/1.0 404 Not Found 2671ms]

GEThttp://127.0.0.1:8000/public/vuexy-assets/css/pages/authentication.css
[HTTP/1.0 404 Not Found 3185ms]

GEThttp://127.0.0.1:8000/public/vuexy-assets-sep/assets/css/style.css
[HTTP/1.0 404 Not Found 3580ms]

GEThttp://127.0.0.1:8000/public/vuexy-assets/images/pages/login.png
[HTTP/1.0 404 Not Found 5053ms]

GEThttp://127.0.0.1:8000/public/vuexy-assets/vendors/js/vendors.min.js
[HTTP/1.0 404 Not Found 3878ms]

GEThttp://127.0.0.1:8000/public/vuexy-assets/js/core/app-menu.js
[HTTP/1.0 404 Not Found 4127ms]

GEThttp://127.0.0.1:8000/public/vuexy-assets/js/core/app.js
[HTTP/1.0 404 Not Found 4425ms]

GEThttp://127.0.0.1:8000/public/vuexy-assets/js/scripts/components.js
[HTTP/1.0 404 Not Found 4681ms]

Loading failed for the <script> with source “http://127.0.0.1:8000/public/vuexy-assets/vendors/js/vendors.min.js”. 127.0.0.1:8000:297:1
Loading failed for the <script> with source “http://127.0.0.1:8000/public/vuexy-assets/js/core/app-menu.js”. 127.0.0.1:8000:302:1
Loading failed for the <script> with source “http://127.0.0.1:8000/public/vuexy-assets/js/core/app.js”. 127.0.0.1:8000:303:1
Loading failed for the <script> with source “http://127.0.0.1:8000/public/vuexy-assets/js/scripts/components.js”. 127.0.0.1:8000:304:1

这是我的问题。当我加载我的网站时,它的前端 UI 消失了,只显示了基本的 HTML 结构。我尝试了每件事来纠正它,但我做不到。

我的布局中的代码


<link rel="stylesheet" type="text/css" href="{{ asset('vuexy-assets/css/bootstrap.css') }}">
        <link rel="stylesheet" type="text/css" href="{{ asset('vuexy-assets/css/bootstrap-extended.css') }}">
        <link rel="stylesheet" type="text/css" href="{{ asset('vuexy-assets/css/colors.css') }}">
        <link rel="stylesheet" type="text/css" href="{{ asset('vuexy-assets/css/components.css') }}">
        <link rel="stylesheet" type="text/css" href="{{ asset('vuexy-assets/css/themes/dark-layout.css') }}">
        <link rel="stylesheet" type="text/css" href="{{ asset('vuexy-assets/css/themes/semi-dark-layout.css') }}">

        <!-- BEGIN: Page CSS-->
        <link rel="stylesheet" type="text/css" href="{{asset('vuexy-assets/css/core/menu/menu-types/vertical-menu.css') }}">
        <link rel="stylesheet" type="text/css" href="{{asset('vuexy-assets/css/core/colors/palette-gradient.css') }}">
        <!-- END: Page CSS-->




 <script  src="{{ asset('/vuexy-assets/vendors/js/vendors.min.js') }}"></script>
    <!-- BEGIN Vendor JS-->

    <!-- BEGIN: Page Vendor JS-->
    <script src="{{ asset('/vuexy-assets/vendors/js/ui/jquery.sticky.js') }}"></script>
    <!-- END: Page Vendor JS-->

    <!-- BEGIN: Theme JS-->
    <script src="{{ asset('/vuexy-assets/js/core/app-menu.js') }}"></script>
    <script src="{{ asset('/vuexy-assets/js/core/app.js') }}"></script>
    <script src="{{ asset('/vuexy-assets/js/scripts/components.js') }}"></script>

我的页面目前看起来像这样 当前页面视图

我试过的

install npm 
npm run div
composer require laravel/ui
php artisan install  bootstrap ui

我也尝试安装yarn,并且sass-loader也从11.0.0降级为“sass-loader”:“10.1.1”

标签: laravelvue.jslaravel-blade

解决方案


默认情况下,Laravel 的资产助手指向应用程序文件夹中的公用文件夹。如果你的资产放在那里,那么你的资产路径应该是这样的。

<a href="{{ asset('vuexy-assets/css/components.css') }}"></a>

代替

<a href="{{ asset('/vuexy-assets/css/components.css') }}"></a>

如果您的资产不在公共目录之外,请在该目录和公共目录之间建立一个魔术链接。


推荐阅读