Error when running wasp db migrate-dev
wasp db start works fine. but i can't get pass wasp db migrate-dev
i am using WSL2

4 Replies
Hi @aman03331. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I'm sorry to hear you're having trouble with
wasp db migrate-dev
. There are several common issues that could cause this command to fail. Based on the knowledge sources, here are some potential problems and solutions:
Possible Issues
1. Database Connection Issues:
If you're using PostgreSQL, make sure your database server is running and accessible at the specified address in your DATABASE_URL. Many users encounter errors like "Can't reach database server" when the database isn't running or there's a connection issue.
2. Non-interactive Environment:
Prisma (which Wasp uses) sometimes detects that the environment is non-interactive and refuses to work. This can happen when trying to use the same database for multiple Wasp projects.
3. System Resource Limitations:
On resource-constrained systems (like EC2 micro instances), the command might hang during the "Building SDK" stage due to insufficient resources.
4. Node Version Compatibility:
Wasp requires Node ^18.12.0. If you're using a different version (like Node 20+), you might get an error message about Node requirements not being met.
5. Path Issues:
If your project path contains whitespace, it might cause issues with the database migration.
Solutions to Try
1. Check Database Connection:
Make sure your database is running. If using PostgreSQL, verify the connection details in your .env file.
2. Run wasp clean
First:
Try running wasp clean
and then attempt wasp db migrate-dev
again.
3. For Resource Issues:
If the command hangs, you might need to use a more powerful machine or try breaking down the process (though this is more complex).
4. Check Node Version:
Run node --version
to verify you're using a compatible version (Node 18.x is recommended).
5. Avoid Whitespace in Paths:
Ensure your project path doesn't contain spaces.
If you could provide the specific error message you're seeing, I could give more targeted advice for your situation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @aman03331, 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?@kapa.ai Please explain the cause and resolution of the following error message shown in a WSL2 environment:
Let me check the knowledge base for you again. One moment! :books:
----------------------
Based on the error message you're seeing, this is a common issue when using Wasp with WSL2 where your project is located on the Windows file system rather than the Linux file system. Let me explain the cause and solution:
Cause
The error occurs because:
1. You're running Wasp in WSL2, but your project files are stored on the Windows file system (indicated by the
\\wsl.localhost\
path)
2. NPM is trying to create a symbolic link from .wasp/out/sdk/wasp
to node_modules/wasp
3. Symbolic links don't work properly when crossing between the Windows and Linux file systems in WSL2
This is a known issue with WSL2 when working with projects that are stored on the Windows file system rather than the Linux file system.
Solution
The solution is to move your Wasp project to the Linux file system within WSL2. This is mentioned in the Wasp documentation:
If you are using WSL2, make sure that your Wasp project is not on the Windows file system, but instead on the Linux file system. Otherwise, Wasp won't be able to detect file changes, due to the issue in WSL2.Quick Start Documentation Here's how to fix it: 1. Move your project from the Windows file system to the Linux file system within WSL2 2. Instead of accessing your files through
/mnt/c/...
or similar Windows paths, store them in your Linux home directory (e.g., /home/username/projects/
)
3. Run wasp clean
to remove any existing generated files
4. Run wasp start
again to regenerate everything properly
This approach is also recommended in this article: Guide to Windows Development with Wasp and WSL
Multiple community members have confirmed this solution works:
If you are on wsl on win, you might have issues with wasp start
not picking up stuff -> that is WSL bug, and solution is to keep your source files, of your wasp project, on linux file system, not win file system.
Discord support thread
This will not only fix the symlink issue but also resolve other potential problems like hot reloading not working properly.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @genyus, 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?@aman03331 if you need the specific steps for the instructions provided by the bot:
1. Move your project to the Linux file system:
2. Navigate to the project in the Linux file system and try running Wasp again: