Cannot find module 'wasp/client/operations' or its corresponding type declarations.
I've got several modules (basically everything in wasp/) that can't be found. I'm running in from wsl2 location, i've tried running wasp clean and rm package-lock.json. Still not sure how to go about troubleshooting this.
6 Replies
Hi @Captain Incredible. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Wohooo @Captain Incredible, you just became a Waspeteer level 1!
----------------------
The error "Cannot find module 'wasp/client/operations' or its corresponding type declarations" typically means that the Wasp SDK packages (like wasp/client/operations) have not been generated or installed correctly. Here are some troubleshooting steps based on the knowledge sources:
1. Run the Wasp Compiler
Make sure you have run the Wasp compiler with
If something broke in the
Docs: CLI Reference - wasp clean 3. Check Your File System Location
Since you are using WSL2, ensure your project is located on the Linux file system (e.g., under
Make sure your import statements match the correct paths. For example: Docs: Tutorial - Invoking the Action on the Client If you've tried all of the above and still have issues, please double-check the output of
Make sure you have run the Wasp compiler with
wasp start
. This step is necessary because Wasp generates the SDK (including the wasp/*
modules) during compilation. If you haven't done this, the modules won't exist and you'll see these errors.Did you run the Wasp compiler at all? Try runningDiscord: Any ideas on some solutions to these errors? 2. Clean and Reinstallwasp start
it needs to compile the SDK for you to have all thewasp/*
packages
If something broke in the
.wasp
folder or node_modules
, run:
This will delete the .wasp
and node_modules
directories. Then run:
This will regenerate everything and reinstall dependencies.Solution was cli: wasp clean (delete all .wasp and node_modules stuff) and wasp start (reinstall all this again)Discord: Any ideas on some solutions to these errors?
Docs: CLI Reference - wasp clean 3. Check Your File System Location
Since you are using WSL2, ensure your project is located on the Linux file system (e.g., under
/home/youruser/
), not on the Windows file system (e.g., /mnt/c/
). Wasp cannot reliably detect file changes on the Windows file system due to a known WSL2 issue, which can cause problems with SDK generation and hot reloading.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.Docs: Quick Start - Installation 4. Check for Typos in Imports
Make sure your import statements match the correct paths. For example: Docs: Tutorial - Invoking the Action on the Client If you've tried all of the above and still have issues, please double-check the output of
wasp start
for any errors, and ensure your Wasp version is up to date (wasp version
). If the problem persists, providing the full error output and your project structure may help further diagnose the issue.
Let me know if you need more help!
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Captain Incredible, 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?for example here is the AccountPage.txs: import type { User } from 'wasp/entities';
import { getCustomerPortalUrl, useQuery } from 'wasp/client/operations';
import { Link as WaspRouterLink, routes } from 'wasp/client/router';
import { logout } from 'wasp/client/auth';
all those wasp imports are not found. However, the code still seems to be working correctly.
wait i think installing the wsl extension fixed it. NVM
what wsl extension do you mean? in vscode?
There is a wsl extension that needs to be installed