freaking out a little bit
WASP 13.2
[ Client ] > [email protected] start
[ Client ] > npm run validate-env && vite
[ Client ]
[ Server ] > [email protected] watch
[ Server ] > nodemon --exec 'npm run bundle-and-start || exit 1'
[ Server ]
[ Client ]
[ Client ] > [email protected] validate-env
[ Client ] > node -r dotenv/config ./scripts/validate-env.mjs
[ Client ]
[ Client!] node:internal/modules/esm/resolve:264
[ Client!] throw new ERR_MODULE_NOT_FOUND(
[ Client!] ^
[ Client!]
[ Client!] Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/jacobferrari/Documents/WASP App/my-saas/app/node_modules/wasp/dist/universal/validators.js' imported from /Users/jacobferrari/Documents/WASP App/my-saas/app/.wasp/out/web-app/scripts/validate-env.mjs
[ Client!] at finalizeResolution (node:internal/modules/esm/resolve:264:11)
[ Client!] at moduleResolve (node:internal/modules/esm/resolve:924:10)
[ Client!] at defaultResolve (node:internal/modules/esm/resolve:1148:11)
[ Client!] at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:390:12)
[ Client!] at ModuleLoader.resolve (node:internal/modules/esm/loader:359:25)
[ Client!] at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:234:38)
[ Client!] at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:87:39)
[ Client!] at link (node:internal/modules/esm/module_job:86:36) {
[ Client!] code: 'ERR_MODULE_NOT_FOUND',
[ Client!] url: 'file:///Users/jacobferrari/Documents/WASP%20App/my-saas/app/node_modules/wasp/dist/universal/validators.js'
[ Client!] }
[ Client!]
[ Client!] Node.js v21.7.1
No idea what’s causing it, already tried deleting package-lock and wasp folder and reinstalling.
27 Replies
Hi @Jacob Ferrari. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the error message you provided, it seems like the issue is related to a missing module
wasp/dist/universal/validators.js
. This could be due to several reasons such as incorrect installation, missing dependencies, or issues with the Wasp version.
Here are a few steps you can try to resolve this issue:
1. Check your Wasp version: Make sure you are using the latest version of Wasp. You can check your version by running wasp version
in your terminal. If you are not on the latest version, you can update Wasp using the command curl -sSL <https://get.wasp-lang.dev/installer.sh> | sh -s
as suggested in Discord support thread: Error building after migrating Wasp to 0.12 > Answers Part 4 (https://discord.com/channels/686873244791210014/1212533517360177253).
2. Run Wasp clean: Try running wasp clean
in your terminal. This command will delete all the generated code and node_modules, essentially resetting your Wasp setup. After running wasp clean
, try running wasp start
again as suggested in Discord support thread: (Resolved) Prisma Error on Mac > Answers Part 1 (https://discord.com/channels/686873244791210014/1223671727943319584).
3. Reinstall Node Modules: Delete the node_modules
folder and run npm install
again. This will reinstall all your Node.js dependencies.
4. Check your code: Ensure that there are no typos or errors in your code that could be causing this issue. Check the paths and names of the imported modules.
If none of the above solutions work, it would be helpful to provide more context or details about your setup or any changes you made prior to encountering this error. This could help in identifying the root cause of the problem.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Jacob Ferrari, 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?At which point did it start happening?
Maybe try running
wasp clean
to get a fresh start 🙏🏼Hm ok this is quite weird. any other errors?
Which change caused this? Is there earlier version of your code that works?
What if you create new simple project with
wasp new
, does it work?I was confused by an error i was getting, it felt like WASP wasn’t in sync with my code, index wasn’t up to date with my actions.ts. So I deleted my .wasp folder as I’ve done before and had it create a new one. Then the error started happening.
Let me try your suggestions
I also tried updating wasp from v12 to 13.2
@miho wasp clean doesnt fix it
Im able to do wasp new and the new project works!
but my main project is still giving me that error
hmm so it happened when you tried to update, or before? maybe try going a few commits back and see if that works?
Could it have anything to do with my node verison?
Wohooo @Jacob Ferrari, you just became a Waspeteer level 1!
@matija How hard would it be to just make a new wasp and transfer my files over?
Okay @matija @miho @martinsos I got it to work, but it feels super breakable, can you guys give me your thoughts?
https://www.loom.com/share/c074005e21b94af498e3b5b4b68565d4?sid=c56f6241-a659-4914-a33f-2e7982b5dcbc
I fix it three quarters into the video
TLDR; When i do a "wasp clean" and then "wasp start", it makes a .wasp folder inside my node_modules/wasp folder. Instead of putting the right folders in the node_modules/dist folder.
Its waspception
@sodic I believe this is something for you to check out
I couldn't reproduce this, did you manage to get the behavior @Jacob Ferrari describes?
I'll try with open-saas
Couldn't reproduce it with a clean installation of OpenSaas either. This is my situation after
wasp clean
and wasp start
@Jacob Ferrari Could you give us more details on how to reproduce the issue? Ideally, you can give me your entire project and I'll try it there 🙂
https://www.loom.com/share/5c358f08d4864f0a8e91b0bc6a491153?sid=3197c589-1227-4ab4-a0f3-8ec6c5f18b82
Heres a more consice loom on it.
I'll dm you the project now! I'll DM you the working version and then you can try the wasp clean and wasp start !
Oh, nice! Sorry I missed this
Checking it out now
I'll dm you the project now! I'll DM you the working version and then you can try the wasp clean and wasp start !Great! I've watched the loom and have a feeling of where the problem is, but am not yet 100% sure. .
I'll try to guess and say it's this thing here:
Try changing that to the relative path and let me know if it works
What I think is happening:
- You're using an absolute import in a file that gets copied into
node_modules/wasp
- Typescript wants to build node_modules/wasp
and needs to decide on the rootDir
: Since you're improting an aboslute path from your project root, it implicitly chooses your project root as the rootDir
- TypeScript replicates the full source tree (from rootDir
onwards) inside the dist folder.
- More details explained in this comment: https://github.com/wasp-lang/wasp/pull/1584#discussion_r1404019301
So, in short, you should be able to fix your problem by correcting all absolute import paths to relative import paths
Note for the rest of the team: We should find a way to prevent users from using aboslute imports, or at least throw an error when they do (this can be done by explicitly setting rootDir
inside the SDK)Just fixing all my absolute paths now and will let you know if it works!
@sodic Yep ! Changed all absolute paths to relative and we working again!! Thank you!
Sorry for my crappy coding skills, sometime im annoyed to figure out the relative path so i go absolute when in development lol
Sorry for my crappy coding skillsHah, no problem, this one's on us as well!
sometime im annoyed to figure out the relative path so i go absolute when in development lolWe all do sketchy stuff in development. But you should be getting autocompletes for these files Maybe we have to look into that as well
Let me know! packages will show up in the autocomplete but not files. But i thought that was just a Cursor/VSCode thing
Wohooo @Jacob Ferrari, you just became a Waspeteer level 2!
Weird... they show up for me
I'll dig in tomorrow
Might just be a “me” issue as well haha
Here's the issue that tracks the bug you ran into Jacob: https://github.com/wasp-lang/wasp/issues/1959
I linked to our discord conversation, hope that's fine 🙂
GitHub
Figure out how to handle absolute paths in user code · Issue #1959 ...
Context When the user imports something using an absolute path instead of a relative one (e.g., import x from '/home/fiilip/.../types' instead of import x from './types'), it breaks...
That’s cool! Thank you!