Error when running migrate-dev
Hi everyone,
I've just created my first project following the guide, but I get an error when running
wasp db migrate-dev
This is the steps I've done so far:
- wasp new
- wasp db
- wasp db migrate-dev
Result:
13 Replies
Hi @Obaydah. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the error message you've provided, it appears you're encountering a dependency resolution issue when trying to run
wasp db migrate-dev
. This error is related to conflicting versions of React and React DOM in your project's dependencies. Let's break down the problem and suggest a solution:
1. The error indicates that your project is trying to use React 18.3.1, but React DOM 19.0.0 is expecting React 19.0.0.
2. This mismatch is causing npm to fail in resolving the dependency tree.
To resolve this issue, you can try the following steps:
1. First, run wasp clean
to remove any cached build artifacts:
2. Next, you should check your package.json
file in the root of your Wasp project. Make sure that the React and React DOM versions are compatible. You might need to update them to matching versions.
3. After adjusting the versions in package.json
, try running the migrate command again:
If the problem persists, you might need to manually delete the node_modules
folder and the package-lock.json
file, then run wasp db migrate-dev
again.
It's worth noting that this error is unusual for a fresh Wasp project created with wasp new
. Typically, Wasp should manage these dependencies correctly. If you're still encountering issues after trying these steps, it might be worth checking your Wasp version and considering updating to the latest version if you're not already using it.
You can check your Wasp version by running:
If you need to update Wasp, you can follow the instructions in the Wasp documentation (https://wasp-lang.dev/docs/quick-start#installation).
If none of these steps resolve the issue, you might want to consider creating a new issue on the Wasp GitHub repository (https://github.com/wasp-lang/wasp/issues) with details about your environment and the steps you've taken, as this could potentially be a bug in Wasp itself.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Obaydah, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?I've encoutered one more issue, but fixed both.
Neither
react-dom
or react-router-dom
was in the package.json
, and that was the issue š
what versions did you set for both? having the same issue rn
Try 19 or 18.2.0
@Obaydah so react should already be in package.json (that is what open-saas comes with), while react-router-dom is not there at the start.
The error you got is because some other library wanted react 19, but your Wasp app is using React 18.
You can't switch to React 19 at the moment, because Wasp hasn't switched to it yet.
So proper solution is to make sure that library that is pulling in react 19 is at the version that uses React 18. Do you know which library it could be, which one have you added?
Also, how did you currently fix it on your side? If you haven't downgraded that library but instead did something else, that might be problematic
The fix was to install correct version of react-dom and react-router-dom:
- react-dom: same version as react
- react-router-dom: I think it was 6.x.x. Just the latest version of it that is compatible
We already install
react-router-dom
and react-dom
in the SDK (a piece of code that powers all the wasp/...
imports) so you shouldn't need to install those. That's weird.
So proper solution is to make sure that library that is pulling in react 19 is at the version that uses React 18. Do you know which library it could be, which one have you added?What Martin said felt like the root cause of some of these issues. So, just by installing the
[email protected]
and [email protected]
it worked out?
You tried using react-hot-toast
if I'm not mistaken?
I just tried it ... and adding "react-dom": "^18.2.0",
to my package.json
made it work as well. Woah. @Filip check this out.
I guess when libraries request React 19 and React DOM 19, the fact that we don't have React DOM listed makes it want to use React DOM 19, but when you list it, it's perfectly fine with React DOM 18.Hey! Maybe I have experienced similar yesterday (?)
In my case I created yesterday new SaaS template and I had problems installing dependencies, I needed to put in my
package.json
:
I already have several apps and it was the first time seeing that errorYep, @Vinny (@Wasp) just updated the template to include the
react-dom
and react-router-dom
deps.
It's related to how npm
resolves peer dependencies of packages e.g. some package says "I require at least React 16" and some other says "I require at least React 18" and npm
figures out what to do and what it requires.yep, I just pushed the updated changes to the remote repo so you can
1. ammemd your package.json to include the explicit react-dom and react-router-dom versions:
or
2. you can just pull a fresh saas template if you haven't starte coding (much) yet:
wasp new -t saas
Not sure if this is right to ping but I was just having issues trying to install storybook and ladle for component stories and it was resolved by explicitly adding react-dom/react-router-dom
Is this something y'all could add to the default template? Having react-dom already in package.json
That's what we did š
And thanks for pinging us!