ricardo
ricardo

Reputation: 81

Laravel Bootstrap navbar collapse

I am developing a app in Laravel and my collapse button not working when I push it the console said " TypeError: can't convert config to string 3 app.js:3449:52

My package.json is:

{
    "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"
    }
}

And my code for my collapse is this

<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>

I checked in firefox and chrome and I am developing in ubuntu 16.04

Upvotes: 2

Views: 2293

Answers (3)

krkc
krkc

Reputation: 31

To add to ricardo's answer: This bootstrap issue explains the cause.

There's a fix on the dev branch, but it's not released yet. Current solution is to downgrade your jQuery to v3.4.1.

Upvotes: 1

ricardo
ricardo

Reputation: 81

SOLVED with this

npm remove jquery

npm install jquery@~3.4.1

Thanks for all

Upvotes: 6

Ahrorbek
Ahrorbek

Reputation: 1

I just fixed this issue by just replacing the public/js/app.js to this file

I think this is not actually the right way to fix this, but I'm new this area, this is what I could do :)

Upvotes: 0

Related Questions