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"
}
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.
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.
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:
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.
The proper way to downgrade jquery version (or any other npm package) in any project including Laravel is this:
Inside package.json
you set which version you want, for example:
"jquery": "3.4.1",
delete node_modules folder (if already created)
delete package-lock.json file (if already there)
run npm install
- this will install the wanted versions of packages inside package.json
(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 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. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With