Error running the Todo App
Hi there,
I have completed the tutorial for the TodoApp, but when I try to run the app I get an error (see attached). I realised that I had made an error in the MainPage.jsx file, so to be on the safe side I copied the code from the Wasp Github repository. But I'm still getting this error and am not sure why or where I should look to avoid it.
4 Replies
Hi @Francesco. 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 that you're having trouble running the TodoApp. Without the specific error message, it's a bit difficult to provide a precise solution. However, I can suggest a few common issues and their solutions based on the knowledge sources provided:
1. TypeScript Error: If you're seeing a TypeScript error related to type declarations, it might be because you're using JavaScript instead of TypeScript. In JavaScript files, you should remove the type declarations. For example, in the
handleSubmit
function, you should catch the error as catch (err)
instead of catch (err: any)
. Source (https://github.com/wasp-lang/wasp/issues/1323)
2. Dependencies Error: If you're having trouble with dependencies, you might need to install them manually using npm. For example, if you're trying to use the "react-clock" dependency, you can install it by running npm install react-clock
in the terminal. Source (https://github.com/wasp-lang/wasp/issues/1324)
3. Module Not Found Error: If you're seeing an error message that says "Cannot find module .wasp/out/server/src/core/auth.js", it might be due to a bug in an older version of Wasp. You can try updating Wasp to the latest version to resolve this issue. Source (https://github.com/wasp-lang/wasp/issues/159)
4. Parse Error: If you're seeing a parse error related to the import path in your Wasp files, make sure that the path starts with "@server/" or "@client/". Source (https://discord.com/channels/686873244791210014/1223304925627285574)
If none of these solutions work, could you please provide the specific error message you're seeing? That would help me provide a more accurate solution.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Francesco, 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?The error message seems to be from the Vite plugin, and reads "Identifier 'Main Page' has already been declared"
I should add that throughout the tutorial everything was going smooth until the very end, when I updated the main page to require authentication. Specifically, this part here:
export const MainPage = ({ user }) => {
// Do something with the user
// ...
}
That's when I started to get this error. I thought it would get rectified by copying the code of all pages from the Wasp github repository, but I still get it. 🤷The error indicates that there are duplicate page names.
Could you check in your Wasp file that you don't have duplicate
page
declarations?
Also, are you naming your components with the same name e.g. two different pages but all are called MainPage
?
If you could maybe paste your Wasp file here, that would be great 😄Thank you so much @miho , I looked into it and found that I had a duplicate MainPage declaration in my wasp file. I removed one and it's working now. Thank you for helping out! 🙏