Reputation: 184
Recently I tried using Ionic with Angular and kept getting this error:
Error: spawn UNKNOWN
at ChildProcess.spawn (node:internal/child_process:413:11)
at Object.spawn (node:child_process:757:9)
at spawn (C:\Users\MyUsername\AppData\Roaming\npm\node_modules\@ionic\cli\node_modules\cross-spawn\index.js:12:24)
at spawn
(C:\Users\MyUsername\AppData\Roaming\npm\node_modules\@ionic\cli\node_modules\@ionic\utils-subprocess\dist\index.js:173:12)
at Subprocess.spawn
(C:\Users\MyUsername\AppData\Roaming\npm\node_modules\@ionic\cli\node_modules\@ionic\utils-subprocess\dist\index.js:146:16)
at Shell.spawn (C:\Users\Colio\AppData\Roaming\npm\node_modules\@ionic\cli\lib\shell.js:151:24)
at async AngularServeCLI.spawn (C:\Users\MyUsername\AppData\Roaming\npm\node_modules\@ionic\cli\lib\serve.js:345:19)
at async AngularServeCLI.spawnWrapper (C:\Users\MyUsername\AppData\Roaming\npm\node_modules\@ionic\cli\lib\serve.js:321:20)
at async AngularServeCLI.serve (C:\Users\MyUsername\AppData\Roaming\npm\node_modules\@ionic\cli\lib\serve.js:311:9)
at async AngularServeRunner.serveProject
(C:\Users\MyUsername\AppData\Roaming\npm\node_modules\@ionic\cli\lib\project\angular\serve.js:117:9)
PS C:\Users\MyUsername\OneDrive\Desktop\Projects\CurrentProject>
I've tried everything I can think of to solve this issue. Apparantly I shouldn't have, because now it's spread to any NPX command using child process. i.e. NPX create-react-app ReactTestApp or ng new
What I have tried:
I am on Windows 11 and I use VS Code,
Any help is greatly appricated and I will be watching this post like a hawk.
UPDATE: Ended up switching computers "resolving" the issue
Upvotes: 4
Views: 19389
Reputation: 1
Most of the time it happens because of your antivirus software. If you disable it, then it should work fine
Upvotes: 0
Reputation: 371
If you are facing a similar issue on a Mac, this command might help:
softwareupdate --install-rosetta
It solved my problem, I tried different node versions and updated the folder permissions but nothing helped.
As I understand, the error happened because the Apple Silicon M2 Chip was not supported and rosetta translates the x64 executable to ARM which prevents the error.
I found the answer here: https://github.com/pa11y/pa11y/issues/619
Upvotes: 15
Reputation: 484
Got the same error solved it by unninstalling my antivirus.
Upvotes: 2
Reputation: 41
Did you install any Android emulators? I had the same issue after installing them. Try turning off Hyper-V or running this command in your Command Prompt and then restarting your PC:
REG add HKCU\Software\Policies\Microsoft\Windows\System /v DisableCMD /t REG_DWORD /d 0 /f
Also, these two links might help you:
Error message: spawn UNKNOWN
Enable Command Prompt
Upvotes: 2