user27572476
user27572476

Reputation: 11

Vite build fails with "Error: spawn UNKNOWN" when loading vite.config.ts

I'm encountering an error when trying to build my Vite project. The build process fails when attempting to load the vite.config.ts file. Here's the error message I'm receiving:

\[ERROR\] error during build:
\[ERROR\] Error: spawn UNKNOWN
\[ERROR\]     at ChildProcess.spawn (node:internal/child_process:421:11)
\[ERROR\]     at Object.spawn (node:child_process:761:9)
\[ERROR\]     at ensureServiceIsRunning %PROJECT_DIR%\\node_modules\\vite\\node_modules\\esbuild\\lib\\main.js:1975:29)
\[ERROR\]     at build (%PROJECT_DIR%\\node_modules\\vite\\node_modules\\esbuild\\lib\\main.js:1873:26)
\[ERROR\]     at bundleConfigFile (file:///%PROJECT_DIR%/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:66504:24)
\[ERROR\]     at loadConfigFromFile (file:///%PROJECT_DIR%/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:66474:27)
\[ERROR\]     at resolveConfig (file:///%PROJECT_DIR%/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:66083:30)
\[ERROR\]     at build (file:///%PROJECT_DIR%/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:65180:24)
\[ERROR\]     at CAC.\<anonymous\> (file:///%PROJECT_DIR%/node_modules/vite/dist/node/cli.js:828:11)
\[ERROR\] -\> \[Help 1\]

Here's my vite.config.ts file:

import { UserConfigFn } from 'vite';
import { overrideVaadinConfig } from './vite.generated';

const customConfig: UserConfigFn = (env) =\> ({
// Here you can add custom Vite parameters
// https://vitejs.dev/config/
});

export default overrideVaadinConfig(customConfig)

Additional information: Operating System: Windows Vite version: [5.4.8] Node.js version: [22.6.0]

The error persists only in the windows environment. With WSL (Oracle 9.8) or in a VM (RHEL 8) it works but the question is why?

Any help would be greatly appreciated!

I'm not sure what's causing this error or how to resolve it. The config file seems to be in the correct location and format. Has anyone encountered this issue before or have any suggestions on how to troubleshoot it?

Upvotes: 0

Views: 427

Answers (1)

user28300209
user28300209

Reputation: 11

Access error, Run in admin access and reinstall the base files again.

Upvotes: 1

Related Questions