How to downgrade jquery version in Laravel How to downgrade jquery version in Laravel laravel laravel

How to downgrade jquery version in Laravel


The proper way to downgrade jquery version (or any other npm package) in any project including Laravel is this:

  1. Inside package.json you set which version you want, for example:

    "jquery": "3.4.1",
  2. delete node_modules folder (if already created)

  3. delete package-lock.json file (if already there)

  4. run npm install - this will install the wanted versions of packages inside package.json

  5. (only for Laravel) run npm run dev - to recompile everything again (with changed version/s of packages)


I know it's late, but for those who just searching around and needs a quick answer for like me, here we goes.

Do the same changes like OP, on package.json (to change the jQuery version).

Then, on CLI, run this command

npm installnpm run dev

I'm not the NPM guy / an expert guy (neither Laravel expert).But, here the explanation,

Seems we need to run npm install, to get the related package and copy it into our node_modules folder.

Then, for npm run dev, it's for compiling our assets (Assuming you're using Laravel default scaffolding)

That's it. Hope it helps. :)


You can also do it old-school style. Hardcode it in your html template:

1.Insert

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous"><link href="{{ asset('css/app.css') }}" rel="stylesheet"><script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script><script src="{{ asset('js/app.js') }}"></script>

2.In resources/js/app.js file, delete require('./bootstrap')

3.Don't import bootstrap in your app.scss file.

You can still compile anything required inside your app.js and app.scss