Vite.config.js troubleshoot

while initialising the first project, the terminal returned this error:

npx --yes vite
failed to load config from /home/project/my-coin-app/vite.config.js
error when starting dev server: Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'vite' imported from /home/project/my-coin-app/vite.config.js.timestamp-1735740601539-a22c14464c01b.mjs
at __node_internal_captureLargerStackTrace2 (https://k03e2io1v3fx9wvj0vr8qd5q58o56n-fkdo.w-corp-staticblitz.com/builtins.ddb8d84d.js:101:5335)
at new NodeError (https://k03e2io1v3fx9wvj0vr8qd5q58o56n-fkdo.w-corp-staticblitz.com/builtins.ddb8d84d.js:101:4149)
at packageResolve (https://k03e2io1v3fx9wvj0vr8qd5q58o56n-fkdo.w-corp-staticblitz.com/builtins.ddb8d84d.js:158:9724)
at moduleResolve (https://k03e2io1v3fx9wvj0vr8qd5q58o56n-fkdo.w-corp-staticblitz.com/builtins.ddb8d84d.js:158:10188)
at defaultResolve (https://k03e2io1v3fx9wvj0vr8qd5q58o56n-fkdo.w-corp-staticblitz.com/builtins.ddb8d84d.js:158:12372)
at ModuleLoader.defaultResolve (https://k03e2io1v3fx9wvj0vr8qd5q58o56n-fkdo.w-corp-staticblitz.com/builtins.ddb8d84d.js:154:3284)
at ModuleLoader.resolve (https://k03e2io1v3fx9wvj0vr8qd5q58o56n-fkdo.w-corp-staticblitz.com/builtins.ddb8d84d.js:154:2989)
at ModuleLoader.getModuleJob (https://k03e2io1v3fx9wvj0vr8qd5q58o56n-fkdo.w-corp-staticblitz.com/builtins.ddb8d84d.js:154:1938)
at https://k03e2io1v3fx9wvj0vr8qd5q58o56n-fkdo.w-corp-staticblitz.com/builtins.ddb8d84d.js:155:1047
at _0x51a3f0.link (https://k03e2io1v3fx9wvj0vr8qd5q58o56n-fkdo.w-corp-staticblitz.com/blitz.c8c182a3.js:40:796440)
at https://k03e2io1v3fx9wvj0vr8qd5q58o56n-fkdo.w-corp-staticblitz.com/builtins.ddb8d84d.js:155:1002

The error message is still pointing to a problem with the vite.config.js file, even though we created one. The core issue is that the WebContainer environment likely has limitations on how it handles module resolution, especially for packages like vite and @vitejs/plugin-react . The error Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'vite' suggests that the module resolution within the WebContainer environment is failing to locate the vite package, even though it’s installed.

Has anyone encountered this problem. Can you give me some hints/directions?

This is not a Bolt.diy issue, it’s specifically an LLM issue. It looks like it either forgot to run npm install (if you have a pacakge.json) or you need to actually install vite in your Web Container first. It appears to literally not be installed.

And why is it importing from /home/project/my-coin-app/vite.config.js.timestamp-1735740601539-a22c14464c01b.mjs?

I feel like there is likely something weird about the code the LLM created. Maybe try something more like Google Gemini Flash 2.0 (Free through Google AI Studio as exp-1210).

1 Like

Thank you, Indeed for some reason VITE was not installed. all set after installing the latest version and run dev

1 Like