W
Waspā€¢3mo ago
Obaydah

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:
šŸ --- Compiling wasp project... --------------------------------------------------


[ Wasp ] Starting npm install
[ Wasp !] npm error code ERESOLVE
[ Wasp !] npm error ERESOLVE unable to resolve dependency tree
[ Wasp !] npm error
[ Wasp !] npm error While resolving: opensaas@undefined
[ Wasp !] npm error Found: [email protected]
[ Wasp !] npm error node_modules/react
[ Wasp !] npm error react@"^18.2.0" from the root project
[ Wasp !] npm error peer react@">=16" from [email protected]
[ Wasp !] npm error node_modules/react-hot-toast
[ Wasp !] npm error react-hot-toast@"^2.4.1" from the root project
[ Wasp !] npm error
[ Wasp !] npm error Could not resolve dependency:
[ Wasp !] npm error peer react@"^19.0.0" from [email protected]
[ Wasp !] npm error node_modules/react-dom
[ Wasp !] npm error peer react-dom@">=16" from [email protected]
[ Wasp !] npm error node_modules/react-hot-toast
[ Wasp !] npm error react-hot-toast@"^2.4.1" from the root project
šŸ --- Compiling wasp project... --------------------------------------------------


[ Wasp ] Starting npm install
[ Wasp !] npm error code ERESOLVE
[ Wasp !] npm error ERESOLVE unable to resolve dependency tree
[ Wasp !] npm error
[ Wasp !] npm error While resolving: opensaas@undefined
[ Wasp !] npm error Found: [email protected]
[ Wasp !] npm error node_modules/react
[ Wasp !] npm error react@"^18.2.0" from the root project
[ Wasp !] npm error peer react@">=16" from [email protected]
[ Wasp !] npm error node_modules/react-hot-toast
[ Wasp !] npm error react-hot-toast@"^2.4.1" from the root project
[ Wasp !] npm error
[ Wasp !] npm error Could not resolve dependency:
[ Wasp !] npm error peer react@"^19.0.0" from [email protected]
[ Wasp !] npm error node_modules/react-dom
[ Wasp !] npm error peer react-dom@">=16" from [email protected]
[ Wasp !] npm error node_modules/react-hot-toast
[ Wasp !] npm error react-hot-toast@"^2.4.1" from the root project
13 Replies
kapa.ai
kapa.aiā€¢3mo ago
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:
wasp clean

wasp clean

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:
wasp db migrate-dev

wasp db migrate-dev

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:
wasp version
wasp version
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?
Obaydah
ObaydahOPā€¢3mo ago
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 šŸ˜…
parzi
parziā€¢3mo ago
what versions did you set for both? having the same issue rn
shindolphin
shindolphinā€¢3mo ago
Try 19 or 18.2.0
martinsos
martinsosā€¢3mo ago
@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
Obaydah
ObaydahOPā€¢3mo ago
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
miho
mihoā€¢3mo ago
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.
NEROX
NEROXā€¢3mo ago
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:
"react": "^18.2.0",
"react-apexcharts": "1.4.1",
"react-dom": "^18.2.0",
"react-hot-toast": "^2.4.1",
"react-icons": "4.11.0",
"react-router-dom": "^6.26.2",
"react": "^18.2.0",
"react-apexcharts": "1.4.1",
"react-dom": "^18.2.0",
"react-hot-toast": "^2.4.1",
"react-icons": "4.11.0",
"react-router-dom": "^6.26.2",
I already have several apps and it was the first time seeing that error
miho
mihoā€¢3mo ago
Yep, @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.
Vinny (@Wasp)
Vinny (@Wasp)ā€¢3mo ago
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:
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.26.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.26.2",
or 2. you can just pull a fresh saas template if you haven't starte coding (much) yet: wasp new -t saas
michael
michaelā€¢3mo ago
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
miho
mihoā€¢3mo ago
That's what we did šŸ˜Š
martinsos
martinsosā€¢3mo ago
And thanks for pinging us!

Did you find this page helpful?