Wasp issue
[ Wasp ] error TS2307: Cannot find module 'wasp/server' or its corresponding type declarations. Getting the above error when doing wasp start. Like I made changes main.wasp everything. Any way to solve this?
10 Replies
Wohooo @Mrr, you just became a Waspeteer level 1!
Hi @Mrr. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
This error typically occurs when the Wasp compiler can't find the required modules. Here are a few steps you can try to resolve this issue:
1. Check your Wasp version: You can do this by running
wasp version
in your terminal. Make sure you're using the latest version of Wasp.
2. Run the Wasp compiler: Try running wasp start
. The Wasp compiler needs to compile the SDK for you to have all the wasp/*
packages.
3. Clean and restart: If the above steps don't work, you can try cleaning your project and restarting it. You can do this by running wasp clean
to delete all .wasp
and node_modules
stuff, and then wasp start
to reinstall everything.
4. Check your imports: Make sure that your imports in your .wasp
file are correct. For example, if you previously had something like import { myFunction } from "@server/myFile.js"
, you should change it to import { myFunction } from "@src/server/myFile.js"
.
If none of the above steps work, it would be helpful to know more about the changes you made in main.wasp
and any other relevant files. Also, please check if there are any other error messages in your terminal or in the browser's developer tools console.
Sources:
- Discord support thread: Hey! Any ideas on some solutions to these errors? > Answers (https://discord.com/channels/686873244791210014/1215750573278629958)
- Discord support thread: nothing shows up in localhost:3000 after wasp start > Answers Part 1 (https://discord.com/channels/686873244791210014/1213958217537814640)
- Docs > Migration from 0.11.X to 0.12.X > How to Migrate? > Migrating Your Project to the New Structure Part 4 (https://wasp-lang.dev/docs/migrate-from-0-11-to-0-12#migrating-your-project-to-the-new-structure)
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Mrr, 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?@Mrr did you try the things the bot suggested?
Yes did wasp clean nd wasp start still the same issue
How does the code look like that gives you the error? The import that fails?
I removed the code which caused me errors.
Now it runs but is this common?? Cannot find module 'wasp/server/operations' or its corresponding type declarations.ts(2307) where I hover its shows this.
I can't say if I don't see your code 🤷♂️ It's not common if everything is setup and used properly, so it might be something that went wrong with your setup or you are using Wasp is unexpected ways
@Mrr would be perfect if you can share "minimal reproducible example" with us. Or you can try telling us, as precisely as you can, which changes you did after which this errors started happenign.
Nope, not common!
@martinsos can I dm?
@Mrr we prefer doing stuff here so the whole team / community can pitch in. Any reason why you would rather dm?