'Karma Server spawn UNKNOWN -4094 Error in Angular Unit Tests
For no understandable reason, I am no longer able to run unit tests in my Angular project because the Karma Server is throwing the odd error shown below.
I am simply running npm test to trigger the unit tests, which should launch a web browser to start the Karma server and then Jasmine to show the test execution.
This is on a Windows 10 PC using VS Code.
PS C:\Code\my-project> npm test
> [email protected] test
> ng test
05 04 2022 13:45:19.898:WARN [karma-server]: Passing raw CLI options to `new Server(config, done)` is deprecated. Use `parseConfig(configFilePath, cliOptions, {promiseConfig: true, throwErrors: true})` to prepare a processed `Config` instance and pass that as the `config` argument instead.
⠙ Generating browser application bundles (phase: building)...05 04 2022 13:45:30.857:WARN [karma]: No captured browser, open http://localhost:9876/
05 04 2022 13:45:30.864:INFO [karma-server]: Karma v6.3.12 server started at http://localhost:9876/
05 04 2022 13:45:30.865:INFO [launcher]: Launching browsers Chrome with concurrency unlimited
05 04 2022 13:45:30.872:INFO [launcher]: Starting browser Chrome
05 04 2022 13:45:30.945:ERROR [karma-server]: UncaughtException: Error: spawn UNKNOWN
at ChildProcess.spawn (internal/child_process.js:403:11)
at spawn (child_process.js:667:9)
at spawnWithSignal (child_process.js:871:17)
at spawnWithoutOutput (C:\Code\my-project\node_modules\karma\lib\launchers\process.js:174:26)
at Object.ProcessLauncher._execCommand (C:\Code\my-project\node_modules\karma\lib\launchers\process.js:75:21)
at Object.ProcessLauncher._start (C:\Code\my-project\node_modules\karma\lib\launchers\process.js:33:10)
at Object.<anonymous> (C:\Code\my-project\node_modules\karma\lib\launchers\process.js:19:10)
at Object.emit (events.js:412:35)
at Object.BaseLauncher.start (C:\Code\my-project\node_modules\karma\lib\launchers\base.js:52:10)
at Object.j (C:\Code\my-project\node_modules\karma\lib\launcher.js:108:17)
at Object.setTimeout.bind.j (C:\Code\my-project\node_modules\qjobs\qjobs.js:143:18)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
05 04 2022 13:45:30.949:ERROR [karma-server]: Error: spawn UNKNOWN
at ChildProcess.spawn (internal/child_process.js:403:11)
at spawnWithSignal (child_process.js:871:17)
at spawnWithoutOutput (C:\Code\my-project\node_modules\karma\lib\launchers\process.js:174:26)
at Object.ProcessLauncher._execCommand (C:\Code\my-project\node_modules\karma\lib\launchers\process.js:75:21)
at Object.ProcessLauncher._start (C:\Code\my-project\node_modules\karma\lib\launchers\process.js:33:10)
at Object.<anonymous> (C:\Code\my-project\node_modules\karma\lib\launchers\process.js:19:10)
at Object.emit (events.js:412:35)
at Object.BaseLauncher.start (C:\Code\my-project\node_modules\karma\lib\launchers\base.js:52:10)
at Object.j (C:\Code\my-project\node_modules\karma\lib\launcher.js:108:17)
at Object.setTimeout.bind.j (C:\Code\my-project\node_modules\qjobs\qjobs.js:143:18)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7) {
errno: -4094,
code: 'UNKNOWN',
syscall: 'spawn'
}
Solution 1:[1]
The solution for me was to uninstall and reinstall Google Chrome on my corporate laptop.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | PoorInRichfield |
