After a long struggle, I solved the problem and I wanted to share it with you.
Firstly , you should sure updated all npm packages.
For this you can use "npm outdated" command. After that you updated all packages.
second step ,
"npx ncu"
npx ncu stands for "npm check updates". It is a command line tool used to check the outdated dependencies in a Node.js project. This command will list the packages that have newer versions available and allows you to upgrade them to the latest version.
My error after this command is that I need to update @types/react version. It may be different for you, but you need to complete the all updates with the "npx ncu" command.
The easiest way to solve is change the version that "npx ncu" command says, in "package.json" and install npm
sample my case;
@types/react ^18.0.26 → ^18.0.27
hope it helps