Problems with imports from WASP
I'm getting this strange with imports from wasp, it says it cannot find a module. I'm Golang developer so frontend tooling isn't that well know for me, and I'm not sure what to do :/
8 Replies
Hi @michalkowal. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I understand that you're having trouble with importing modules from Wasp. This is a common issue that can occur due to a variety of reasons. Here are a few steps you can take to resolve this:
1. Check your Wasp version: Make sure you have the correct version of Wasp installed. You can check this by running
wasp version
in your terminal. If you're not on the latest version, consider updating it.
2. Run the Wasp compiler: The Wasp compiler needs to compile the SDK for you to have all the wasp/*
packages. You can do this by running wasp start
in your terminal.
3. Clean your project: Sometimes, issues can occur due to problems in the .wasp
folder. You can clean your project by running wasp clean
in your terminal. This command deletes all .wasp
and node_modules
stuff. After running this command, you can run wasp start
to reinstall everything again.
4. Check your import statements: Make sure that the modules you're trying to import actually exist and are exported correctly. If you're trying to import a module that doesn't exist or isn't exported, you'll get an error.
5. Check your file extensions: If you're providing a path to a server file without a .js
extension, that might not work and could result in an error. Make sure to include the correct file extensions in your import statements.
If you're still having trouble after trying these steps, it would be helpful to see the specific error message you're getting and the code where the error occurs. This will help in diagnosing the problem more accurately.
Here are some relevant discussions and issues that might help you:
- Discord support thread: Hey! Any ideas on some solutions to these errors? (https://discord.com/channels/686873244791210014/1215750573278629958)
- Github Issue: Improve error messages reported by the framework code (https://github.com/wasp-lang/wasp/issues/1664)
- Discord support thread: nothing shows up in localhost:3000 after wasp start (https://discord.com/channels/686873244791210014/1213958217537814640)
- Github Issue: Fix inconsistent import extensions in both .wasp file and in JS files (https://github.com/wasp-lang/wasp/issues/1363)
- Github Issue: Design nicer imports for our SDK (https://github.com/wasp-lang/wasp/issues/1657)
- Discord support thread: import actions into main.wasp (https://discord.com/channels/686873244791210014/1216119302244270181)
- Discord support thread: Post-query errors about failing to resolve an import (https://discord.com/channels/686873244791210014/1214694033683914762)
- Github Issue: Upgrade to React 17 (https://github.com/wasp-lang/wasp/issues/581)
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @michalkowal, 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?^ those aren't working 😄
OKAY thats strange.
When I edit the import by adding some signs and then revert it to the base version it works XD
@michalkowal well that is weird!
Do you have
wasp start
running in the background?
What happens if you restart your TS language server, does that help?Hey. Tbh how to do that, tho I fully moved to the WSL and it worked
Wohooo @michalkowal, you just became a Waspeteer level 1!
I guess windows is basd
bad*
Aaaaah ok, yeah that has to be it! Ok, all solved then, great.
If you will ever need ot restart TS language serve,r you can do it by opening command pallete in VSCode and typing "restart TS language server". But if you don't need it, don't bother with it.
Thanks mate! 😄