If you have tried all the ways and it still doesn't work, react-router-dom may have the wrong package.json, you need to check whether a second node_modules is created while creating it. This is the reason why I couldn't solve it for a day. If it was created in the parent folder, after deleting it, go to your own file with 'cd file name' and download it again to package.json.