Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to downgrade jquery version in Laravel

Tags:

jquery

laravel

I'm facing some bootstrap problem with jquery 3.5.0 in Laravel. I'm trying to downgrade my jquery to 3.4.1 version but then when I edit the package.json and run composer update my jquery version doesn't change. Can anyone solve my problem? Below is my package.json file.

"devDependencies": {
    "axios": "^0.19",
    "bootstrap": "^4.0.0",
    "cross-env": "^7.0",
    "jquery": "3.4.1",
    "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"
}
like image 549
Sherwin Variancia Avatar asked Apr 25 '20 14:04

Sherwin Variancia


People also ask

How to upgrade and downgrade Laravel?

Here is the Laravel Upgrade Guide where you can verify the functions that need to be updated at the code level. If you are upgrading, then you need to add the listed updated functions of the higher version from the guide. And if downgrading, you need to remove the updated functions from your code if you have used any from the higher version.

How do I upgrade my Laravel application to Php 8?

You can use Laravel Shift to help automate your application upgrades. Laravel now requires PHP 8.0.2 or greater. You should update the following dependencies in your application's composer.json file: In addition, please replace facade/ignition with "spatie/laravel-ignition": "^1.0" in your application's composer.json file.

Can I use a lower version of Laravel with composer?

And it is totally fine if we want to use a lower version because some packages are not always updated and supported by laravel’s latest version. So, let’s begin without wasting any of your precious time. Assuming that you have already installed composer on your local machine. If you want to install a specific major version for laravel:

Are there any breaking changes in the Laravel framework?

We attempt to document every possible breaking change. Since some of these breaking changes are in obscure parts of the framework only a portion of these changes may actually affect your application. Want to save time? You can use Laravel Shift to help automate your application upgrades. Laravel now requires PHP 8.0.2 or greater.


2 Answers

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)

like image 168
lewis4u Avatar answered Oct 19 '22 16:10

lewis4u


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 install

npm 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. :)

like image 28
wandyyd Avatar answered Oct 19 '22 16:10

wandyyd