Export 'unstable_act' (imported as 'React') was not found in 'react'

Viewed 300

I developed an application with react-three-gui and @react-three/drei. After experimenting with the package.json, I was given the following error:

Error in question after changing the package.json file

Error in question after changing the package.json file

But despite everything, even after undoing my changes, the error remains.

Things I have tried:

  • deleting node modules and reinstalling (no changes)
  • undoing changes and going to previous commits (error remained even then)
  • deleting only react-three-fiber (react-three-gui throws an error)

I have spent days looking for a solution but can't find one that relates to this specific problem. Anything helps.

package.json

Picture of package.json

2 Answers

Was able to solve the problem by just creating a new react project, and transferring the code and 3d models I created to the new project. Once I reinstalled the necessary packages into the new project, everything started working again perfectly.

The issue is in the dependencies.

First of all there's both react-three-fiber and @react-three/fiber. The former dependency is deprecated, but it has a dependency on @react-three/fiber and version latest.

So, this leads to a dependency on the latest version of @react-three/fiber which in turn has a dependency on "react": "^18.0.0", despite the "react": "^17.0.2" set in your project's package.json.

So, make sure you get rid of the deprecated dependency and align the dependencies so there are no version conflicts.

Reference for a similar issue: https://github.com/pmndrs/react-three-fiber/issues/2037

Related