Laravel 6:语法错误,意外的'js'(T_STRING),期望')'

时间:2019-09-13 10:43:44

标签: laravel-6

我正在使用资产助手在我的Laravel 6应用程序中添加JavaScript文件:<script src="{{ asset('js/todolist.js') }}"></script>这是我得到的错误:

  

Facade \ Ignition \ Exceptions \ ViewException

     

语法错误,意外的'js'(T_STRING),期待的')'(查看:C:\ Dev \ Laravel \ teacher \ resources \ views \ layouts \ base.blade.php)

JS文件位于我的public/js文件夹下。

这是我的刀片文件内容:

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>
        @section('title')
            {{ config('app.name', 'Laravel') }}
        @endsection
        @yield('title')
    </title>
    <!-- plugins:css -->
    <link rel="stylesheet" href="{{ asset('vendors/ti-icons/css/themify-icons.css') }}">
    <link rel="stylesheet" href="{{ asset('vendors/css/vendor.bundle.base.css') }}">
    <!-- endinject -->
    <!-- Plugin css for this page -->
@yield('css_top')
<!-- End plugin css for this page -->
    <!-- inject:css -->
    <link rel="stylesheet" href="{{ asset('css/vertical-layout-light/style.css') }}">
    <!-- endinject -->
    <link rel="shortcut icon" href="{{ asset('images/favicon.png') }}"/>
</head>
<body>
<div class="container-scroller">
    <!-- partial:partials/_navbar.html -->
@include('partials._navbar')
<!-- partial -->
    <div class="container-fluid page-body-wrapper">
        <!-- partial:partials/_settings-panel.html -->
    @include('partials._settings-panel')
    <!-- partial -->
        <!-- partial:partials/_sidebar.html -->
    @include('partials._sidebar')
    <!-- partial -->
        <div class="main-panel">
            <div class="content-wrapper">
                @yield('content')
            </div>
            <!-- content-wrapper ends -->
            <!-- partial:partials/_footer.html -->
        @include('partials._footer')
        <!-- partial -->
        </div>
        <!-- main-panel ends -->
    </div>
    <!-- page-body-wrapper ends -->
</div>
<!-- container-scroller -->

<!-- plugins:js -->
<script src="{{ asset('vendors/js/vendor.bundle.base.js') }}"></script>
<!-- endinject -->
<!-- Plugin js for this page -->
<script src="{{ asset('vendors/chart.js/Chart.min.js') }}"></script>
<!-- End plugin js for this page -->
<!-- inject:js -->
<script src="{{ asset('js/off-canvas.js') }}"></script>
<script src="{{ asset('js/hoverable-collapse.js') }}"></script>
<script src="{{ asset('js/template.js') }}"></script>
<script src="{{ asset('js/settings.js }}"></script>
<script src="{{ asset('js/todolist.js') }}"></script>
<!-- endinject -->
<!-- Custom js for this page-->
@section('css_bottom')
    <script src="{{ asset('js/dashboard.js') }}"></script>
@endsection
@yield('css_bottom')
<!-- End custom js for this page-->
</body>
</html>

请帮助。

更新: 添加了刀片文件

1 个答案:

答案 0 :(得分:0)

我的刀片文件中的某个地方有错误。

我忘了加撇号并关闭括号:

此处:<script src="{{ asset('js/settings.js }}"></script>

,并且已在此处报告错误:

<script src="{{ asset('js/todolist.js') }}"></script>

通过添加撇号和括号进行更正后,一切正常。