Reputation: 81
When ever I try to execute npm start, this is what happens. I think there is some issue with powershell and not with npm because npm starts the development server. BTW I created basic react app using npx create-react-app. I checked, powershell file is there in the specified location and it is working as well. Guild me what should I do in order to resolve the error.
events.js:353
throw er; // Unhandled 'error' event
^
Error: spawn C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
at onErrorNT (internal/child_process.js:467:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
at onErrorNT (internal/child_process.js:467:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell',
path: 'C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell',
spawnargs: [
'-NoProfile',
'-NonInteractive',
'–ExecutionPolicy',
'Bypass',
'-EncodedCommand',
'UwB0AGEAcgB0ACAAIgBoAHQAdABwADoALwAvAGwAbwBjAGEAbABoAG8AcwB0ADoAMwAwADAAMAAiAA=='
]
}
Upvotes: 7
Views: 8423
Reputation: 56
Try export BROWSER=none
Reference: https://github.com/facebook/create-react-app/issues/7251#issuecomment-827602712
I got this problem when using podman
and wsl
Upvotes: 3
Reputation: 21
I had the same issue on WSL and resolved by modifying my /etc/wsl.conf
wsl.conf that caused the error (apparently by modifying the path to powershell.exe into something wrong):
[network]
generateResolvConf = false
mount -t drvfs C: /mnt/c
root = /
options = metadata
wsl.conf that works:
[network]
generateResolvConf = false
Some background for this error causing wsl.conf:
I had issues accessing /mnt/c from my WSL and had changed the wsl.conf originally into the error causing one. As instructed here: https://github.com/microsoft/WSL/issues/1864#issuecomment-506005637
Upvotes: 0
Reputation: 11
I don't know why this error occurs , I sated paths and all but nothing it worked. But I have one solution
simply write your code in git bash . you can also change your vs code terminal to git bash. Link to change = " https://blog.danielpadua.dev/posts/git-bash-with-vscode/ ".
Upvotes: 1
Reputation: 71
I faced with a same problem on Windows 10. And solution was a pretty simple - just run your commands in git bush console.
Upvotes: 6
Reputation: 11
Step 1:(reason of the error)
go to C:\Windows\System32\WindowsPowerShell\v1.0 and then you will not be found powershell.exe file that folder.
Step 2: (solution of the error)
download powershell.exe file online or just copy and paste this file in C:\Windows\System32\WindowsPowerShell\v1.0
https://www.exefiles.com/en/exe/powershell-exe/ - To download powershell.exe file online
Upvotes: 1
Reputation: 81
So after trying everything and looking for the error on every possible website. I still wasn't able to resolve the error. Then I personally talked to someone regarding the error and he suggested me to run it in Windows Sub-system for Linux (WSL). I exactly did that and installed WSL with Linux 20.04 LTS. Now I am using Unix terminal to create the react app. It isn't the best solution for the problem, but yeah it does work and saves a lot of time!
Upvotes: 1