Reputation:
I am trying to create a react project i have run npx create-react-app my-app
then cd my-app
but when I've npm start
this error has been shown:
> [email protected] start C:\Users\USER\my-app
> react-scripts start
i 「wds」: Project is running at http://192.168.137.1/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from C:\Users\HAMOOD\my-app\public
i 「wds」: 404s will fallback to /
Starting the development server...
events.js:292
throw er; // Unhandled 'error' event
^
Error: spawn powershell ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn powershell',
path: 'powershell',
spawnargs: [
'-NoProfile',
'-NonInteractive',
'–ExecutionPolicy',
'Bypass',
'-EncodedCommand',
'UwB0AGEAcgB0ACAAIgBgACIAaAB0AHQAcAA6AC8ALwBsAG8AYwBhAGwAaABvAHMAdAA6ADMAMAAwADAAYAAiACIA'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HAMOOD\AppData\Roaming\npm-cache\_logs\2020-08-23T13_09_04_330Z-debug.log
i have tried to to delete the node_modules then I've installed it another time but the same issue still happening
Upvotes: 7
Views: 8800
Reputation: 417
1- First you need to edit system environment variable and locate where you have Windows Poweshell so add new in "system environment variable path"
2- Then Open Window PoweShell as An Administraror And Write these Two Commands :
:) Upgrade Window PowerShell because your nodejs and npm is updated but powershell is not updated so its making conflict with your npm start or expo start,so you should need to upgrade windows powershell
And Then run Cmd and also run your poject npm start or expo start so quickly it will work!
BEST OF LUCK!
Upvotes: 2
Reputation: 95
Goto > Control Panel\System and Security\System\Advance system setting\Enviroment variable and set system variables path C:\Windows\System32\ variable and restart your System.
Upvotes: 2
Reputation: 478
I've found some possible solutions. Seems that you are using powershell, check firstly that you have it in your PATH as %SystemRoot%/system32/WindowsPowerShell/v1.0. After that open powershell as admin and write
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
It should help in case there is problem with powershell. OR, sometimes it could be an error while cra dev server is trying to open web browser. Someone on github said that this helped him:
This error stems from the fact that CRA tries to open your browser: In order to skip opening the browser, add
BROWSER=none
to your .env or .env.local file
Another way is to downgrade react scripts for project with these commands
npm install [email protected]
npm start
Upvotes: 13