Background
I’m running a Kubernetes cluster in Docker using kind
. One of the pods in the cluster is running a React app using react-scripts start
. After the console shows ‘Starting the development server’, it throws an error that powershell cannot be found and exits. Below is the stack trace:
30 node:events:491
31 throw er; // Unhandled 'error' event
32 ^
33
34 Error: spawn /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe ENOENT
35 at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
36 at onErrorNT (node:internal/child_process:485:16)
37 at processTicksAndRejections (node:internal/process/task_queues:83:21)
38 Emitted 'error' event on ChildProcess instance at:
39 at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
40 at onErrorNT (node:internal/child_process:485:16)
41 at processTicksAndRejections (node:internal/process/task_queues:83:21) {
42 errno: -2,
43 code: 'ENOENT',
44 syscall: 'spawn /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe',
45 path: '/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe',
46 spawnargs: [
47 '-NoProfile',
48 '-NonInteractive',
49 '–ExecutionPolicy',
50 'Bypass',
51 '-EncodedCommand',
52 'UwB0AGEAcgB0ACAAIgBoAHQAdABwADoALwAvAGwAbwBjAGEAbABoAG8AcwB0ADoAMwAwADAAMAAiAA=='
53 ]
54 }
55 error Command failed with exit code 1.
Other Information
I’m using WSL2 with Docker and Ubuntu. Running wsl -l -v
gives this:
NAME STATE VERSION
* Ubuntu-22.04 Running 2
docker-desktop-data Running 2
docker-desktop Running 2
docker context ls
returns:
NAME TYPE DESCRIPTION DOCKER ENDPOINT
KUBERNETES ENDPOINT ORCHESTRATOR
default moby Current DOCKER_HOST based configuration npipe:////./pipe/docker_engine
desktop-linux * moby Docker Desktop npipe:////./pipe/dockerDesktopLinuxEngine
desktop-windows moby Docker Desktop npipe:////./pipe/dockerDesktopWindowsEngine
I manually checked the filesystem for WSL and confirmed that the powershell executable is there. After opening a new terminal and running wsl
, cd /mnt/c/Windows/System32/WindowsPowerShell/v1.0
and doing ls
:
Certificate.format.ps1xml Help.format.ps1xml Registry.format.ps1xml getevent.types.ps1xml pspluginwkr.dll
Diagnostics.Format.ps1xml HelpV3.format.ps1xml Schemas ko-KR pwrshmsg.dll
DotNetTypes.format.ps1xml Modules SessionConfig **powershell.exe** types.ps1xml
Event.Format.ps1xml PSEvents.dll WSMan.Format.ps1xml powershell.exe.config typesv3.ps1xml
Examples PowerShellCore.format.ps1xml en powershell_ise.exe zh-CN
FileSystem.format.ps1xml PowerShellTrace.format.ps1xml en-US powershell_ise.exe.config zh-TW
Kindly advise how I can go about troubleshooting this. It’s a real headache, any help would be greatly appreciated
1