Issue Deploying Frontend - "Cannot find package 'wasp'" (Wasp 0.15)
Hi Wasp Support,
I'm trying to deploy the frontend of my Wasp application on a production VM using Wasp 0.15.0 but I keep getting this error when running npm run build:
up to date, audited 79 packages in 815ms
11 packages are looking for funding
run
npm fund
for details
found 0 vulnerabilities
[email protected] build npm run validate-env && tsc && vite build
[email protected] validate-env node -r dotenv/config ./scripts/validate-env.mjsnode:internal/modules/esm/resolve:854 throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null); ^ Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'wasp' imported from /home/admin/sas/build/web-app/scripts/validate-env.mjs at packageResolve (node:internal/modules/esm/resolve:854:9) at moduleResolve (node:internal/modules/esm/resolve:927:18) at defaultResolve (node:internal/modules/esm/resolve:1169:11) at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:542:12) at ModuleLoader.resolve (node:internal/modules/esm/loader:510:25) at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:239:38) at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:96:40) at link (node:internal/modules/esm/module_job:95:36) { code: 'ERR_MODULE_NOT_FOUND' } Current setup: Wasp version: 0.15.0 Node.js version: 20.18.2 npm version: 10.8.2
5 Replies
Hi @Taha. 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 information provided in your question and the knowledge sources available, it appears you're encountering an issue with deploying the frontend of your Wasp application. The error message suggests that the 'wasp' package cannot be found during the build process.
This error is likely related to the way Wasp manages dependencies and the SDK in version 0.15.0. Here are a few potential solutions and explanations:
1. Missing Wasp SDK: The error indicates that the 'wasp' package is not found. This could be because the Wasp SDK is not properly installed or referenced in your project's dependencies.
2. Node.js version compatibility: While you're using Node.js 20.18.2, it's worth noting that Wasp typically recommends using the latest LTS version of Node.js, which is currently version 18. There might be some compatibility issues with Node.js 20.
3. Build process: The error occurs during the
npm run build
command, specifically in the validate-env
script. This script is trying to import from the 'wasp' package, which is not found.
To resolve this issue, you can try the following steps:
1. Ensure that you've run wasp start
at least once on your development machine before deploying. This compiles the Wasp SDK and generates necessary files.
2. Try running wasp build
instead of npm run build
. This should handle the compilation and building process for Wasp projects.
3. If you're deploying manually, make sure you've copied over the entire .wasp
directory to your production environment.
4. Consider downgrading to Node.js 18 LTS to ensure compatibility with Wasp 0.15.0.
5. If the issue persists, you might need to manually install the Wasp SDK in your project. You can do this by running npm install wasp
in your project directory.
If these steps don't resolve the issue, it might be helpful to check the Wasp documentation or reach out to the Wasp community for more specific guidance on deploying Wasp 0.15.0 applications.
Wasp GitHub Issues might also provide more recent information or similar reported issues that could help in resolving this problem.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Taha, 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?Hey @Taha did any of these suggestions work for you?
I'm trying to deploy the frontend of my Wasp application on a production VM using Wasp 0.15.0 but I keep getting this error when running npm run build:What are the exact command you are running on the VM? The command for building Wasp apps for production is
wasp build
. If you haven't, please read through the deployment docs: https://wasp-lang.dev/docs/deployment/introIntroduction | Wasp
After developing your app locally on your machine, the next step is to deploy it to the web so that others can access it.
Yes i moved to wasp0.16 and it works, I think the tsconfig.json file made it possible
awesome! glad it's working for you.