Laravel引导导航栏崩溃

lnvxswe2  于 2022-12-01  发布在  其他
关注(0)|答案(3)|浏览(132)

我正在Laravel中开发一个应用程序,当我按下折叠按钮时,控制台显示“TypeError:无法将配置转换为字符串3 app.js:3449:52
我的package.json是:

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch": "npm run development -- --watch",
        "watch-poll": "npm run watch -- --watch-poll",
        "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
        "prod": "npm run production",
        "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
    },
    "devDependencies": {
        "axios": "^0.19",
        "bootstrap": "^4.4.1",
        "cross-env": "^7.0",
        "jquery": "^3.2",
        "laravel-mix": "^5.0.1",
        "lodash": "^4.17.13",
        "popper.js": "^1.12",
        "resolve-url-loader": "^2.3.1",
        "sass": "^1.20.1",
        "sass-loader": "^8.0.0",
        "vue": "^2.5.17",
        "vue-template-compiler": "^2.6.10"
    }
}

我崩溃的密码是

<nav class="navbar bg-white shadow-sm navbar-light">
    <div class="container">
        <a class="navbar-brand" href="{‌{ route('home') }}">
            {‌{ config('app.name') }}
        </a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{‌{ __('Toggle navigation') }}">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="nav nav-pills">
                <li class="nav-item">
                    <a class="nav-link {‌{ setActive('home') }}" href="{‌{ Route('home')}}">Home</a>
                </li>
                {‌{--<li class="nav-item">
                    <a class="nav-link {‌{ setActive('login') }}" href="{‌{ Route('login')}}">Login</a>
                </li>--}}
                <li class="nav-item">
                    <a class="nav-link {‌{ setActive('contact') }}" href="{‌{ Route('contact')}}">Contact</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link {‌{ setActive('cookies') }}" href="{‌{ Route('cookies')}}">Cookies</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link {‌{ setActive('legal') }}" href="{‌{ Route('legal')}}">Legal</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link {‌{ setActive('policy') }}" href="{‌{ Route('policy')}}">Policy</a>
                </li>
            </ul>
        </div>
    </div>
</nav>

我签了火狐和chrome,我正在开发ubuntu 16.04

6fe3ivhb

6fe3ivhb1#

用这个解决

npm remove jquery

npm install jquery@~3.4.1

谢谢你们

i7uq4tfw

i7uq4tfw2#

对李嘉图的回答再加一句:此bootstrap issue说明了原因。
有一个关于dev分支的修正,但是还没有发布。目前的解决方案是将你的jQuery降级到v3.4.1。

vmjh9lq9

vmjh9lq93#

我只是通过将public/js/app.js替换为this文件来修复此问题
我认为这不是解决这个问题的正确方法,但我是这个领域的新手,这是我能做的:)

相关问题