【问题标题】:console showing script loading failed in laravel在 laravel 中显示脚本加载失败的控制台
【发布时间】:2021-08-05 04:36:15
【问题描述】:

问题(显示在控制台中)


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”

【问题讨论】:

  • 您好,请检查您是否在这里获得了正确的路径{{ asset('vuexy-assets/css/bootstrap.css') }}
  • 另外,您可以查看开发工具并检查元素是否应用了css。
  • 我解决了。通过从我的链接中删除 \public。
  • 太棒了:-)。把它写成答案并接受它,这样如果有人遇到类似的事情,他们会很容易找到答案。

标签: laravel vue.js laravel-blade


【解决方案1】:

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

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

代替

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

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

【讨论】:

    【解决方案2】:

    重写链接

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

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

    这将纠正以下错误。

    【讨论】:

      猜你喜欢
      • 2021-12-08
      • 2017-03-29
      • 1970-01-01
      • 2016-05-25
      • 2019-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多