Skip to content Skip to sidebar Skip to footer

Cannot Convert Object To Primitive Value Error In React Application?

I'm developing a simple react-spring boot application, but because of a GitHub issue I recreate my application starter files using IntelliJ and installed the node modules using the

Solution 1:

First, remove jQuery:

npm remove jquery

and then reinstall it:

npm install jquery@~3.4.1

Solution 2:

I had the same problem in a rails 6 project I was developing. I am using bootstrap 4.4.1 and had the exact same problem with my collapsing navigation bar: The navbar collapses but the hamburger button which appears on collapse was not clickable.

The solution: Downgrade jquery from 3.5.0 to 3.4.1. I did not look into the actual reason of the error for now.

To add more details, the jquery version should be updated in package.json dependencies and don't forget to run yarn install --check-files after you do this for the change to be applied.

Solution 3:

This is related to jQuery 3.5.0. It is a breaking change that affects many plugins. Temporarily reverting to a previous version of jQuery (like 3.4.1) fixed the issue for me.

or

Locate your Jquery package in project node_modules, delete it and reinstall it using this command

npm install jquery@~3.4.1

Source: jQuery Issue #4665

Solution 4:

Like many others have said, I had the same issue with thanks to jquery 3.5.0.

It appears that this is now fixed with 3.5.1

Solution 5:

I removed jQuery with yarn remove jquery, and then installed yarn add jquery@3.4.1 to downgrade.

The issue was that 3.5.0 was still found in the yarn.lock file, thus the error was still occurring.

I had to add in package.json, outside of the "dependencies" section:

"resolutions":{"jquery":"3.4.1"},

Finally the error was gone.

Post a Comment for "Cannot Convert Object To Primitive Value Error In React Application?"