I created a react app with yarn. It showed me ENOENT errors while starting the development server.
C:Users\Dera\reactprojects\rcipe\yarn start
yarn run v1.12.3
warning ..\package.json: No license field
$ react-scripts start
Starting the development server...
events.js:173
throw er; //Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.one exit``
For me, it worked by installing a previous version of npm-scripts.
Try using:
npm install react-scripts#2.1.8
Related
I am trying to create a react application, but it gives the following errors:
Creating a new React app in C:\Users\Admin\Desktop\study\portfoliosite\mysite\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template-typescript...
Aborting installation.
Unexpected error. Please report it as a bug:
Error: spawn UNKNOWN
at ChildProcess.spawn (node:internal/child_process:412:11)
at Object.spawn (node:child_process:698:9)
at spawn (C:\Users\Admin\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\cross-spawn\index.js:12:24)
at C:\Users\Admin\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:390:19
at new Promise (<anonymous>)
at install (C:\Users\Admin\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:341:10)
at C:\Users\Admin\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:468:16
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
errno: -4094,
code: 'UNKNOWN',
syscall: 'spawn'
}
Deleting generated file... package.json
Deleting my-app/ from C:\Users\Admin\Desktop\study\portfoliosite\mysite
Done.
I had the same exact error. It was because my anti-virus software viewed the react installation as malware.
Try to clean the cache npm cache clean --force than npx clear-npx-cache and run again npx create-react-app my-app or npx create-react-app#latest my-app --use-npm.
If You still have this problem run Try to run cmd as administrator.
If You installed create-react-app globaly than run npm uninstall -g create-react-app.
Also notice that create-react-app required Node >= 14.0.0 and npm >= 5.6 on your machine
For me It's a antivirus issue, update your antivirus and try. I have faced this issue in windows 11.
Scan your pc/laptop with updated antivirus
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\Vishnu\react> npx create-react-app vikas
Creating a new React app in C:\Users\Vishnu\react\vikas.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
Aborting installation.
Unexpected error. Please report it as a bug:
Error: spawn UNKNOWN
at ChildProcess.spawn (node:internal/child_process:412:11)
at Object.spawn (node:child_process:698:9)
at spawn (C:\Users\Vishnu\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\cross-spawn\index.js:12:24)
at C:\Users\Vishnu\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:407:19
at new Promise (<anonymous>)
at install (C:\Users\Vishnu\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:359:10)
at C:\Users\Vishnu\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:485:16
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
errno: -4094,
code: 'UNKNOWN',
syscall: 'spawn'
}
Deleting generated file... package.json
Deleting vikas/ from C:\Users\Vishnu\react
Done.
PS C:\Users\Vishnu\react> npx create-react-app vikas
Follow the Following Steps.
open powershell/cmd and run.
npm cache clean --force
Run
npm cache verify
Run
npm install create-react-app vikas
Run
npx create-react-app vikas
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:
> my-app#0.1.0 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! my-app#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app#0.1.0 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
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 react-scripts#2.1.8
npm start
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.
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!
I am trying create my first react app and running into issues basically at step 1. I am trying npm start on the default create-react-app install and I am getting the follow error. I have included screenshots showing create-react-app ran successfully but that has not fixed anything. I have included screenshots of it successfully running create-react-app and of me running npm start with no luck. Thanks.
Here is the log file:
18 verbose npm v6.4.1
19 error file sh
20 error code ELIFECYCLE
21 error errno ENOENT
22 error syscall spawn
23 error robofriends#0.1.0 start: react-scripts start
23 error spawn ENOENT
24 error Failed at the robofriends#0.1.0 start script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
I tried this solution and it did not work for me:
stackoverflow.com/a/42539669/5069226
create-react-app running
npm start failing
Looks like this has to do with your workspace path.
I tried to replicate this on my machine with the path /tmp/Users/Neil/Desktop/Complete Web Developer/Section 18_React:Redux/robofriends, and i was able to reproduce your error.
╭─ /tmp/Users/Neil/Desktop/Complete Web Developer/Section
18_React:Redux/robofriends
╰ yarn start K8S: tools 11:37:33
yarn run v1.7.0
$ react-scripts start
/bin/sh: react-scripts: command not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
But when i moved the robofriends directory up higher in the tree, it worked fine.
╭─ /tmp/Users/robofriends
╰ yarn start K8S: tools INT(-2) ↵ 11:38:34
yarn run v1.7.0
Starting the development server...
I guessed it could be either the long path to node modules or the non-alphanum characters you have in your path, :,_. So i went back down to the React:Redux directory and renamed it to ...React_Redux and tried npm start again in /tmp/Users/Neil/Desktop/Complete Web Developer/Section 18_React_Redux/robofriends`, and it worked just fine :)
So looks like npm doesn't like the : in the executable path.
I was trying to set up nodeJs for AngularJs on my operating System (Ubuntu 14.04) following this: guideline for installing angular js components
but when tried running the last command, found this error. Can any one help.
usman#usman-cs:~/angular-phonecat$ npm run protractor
angular-phonecat#0.0.0 preprotractor /home/usman/angular-phonecat
npm run update-webdriver
angular-phonecat#0.0.0 preupdate-webdriver /home/usman/angular-phonecat
npm install
angular-phonecat#0.0.0 postinstall /home/usman/angular-phonecat
bower install
angular-phonecat#0.0.0 update-webdriver /home/usman/angular-phonecat
webdriver-manager update
selenium standalone is up to date.
chromedriver is up to date.
angular-phonecat#0.0.0 protractor /home/usman/angular-phonecat
protractor test/protractor-conf.js
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
[launcher] Process exited with error code 1
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:988:11)
at Process.ChildProcess._handle.onexit (child_process.js:779:34)
npm ERR! weird error 8
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! not ok code 0
usman#usman-cs:~/angular-phonecat$
I think you should run npm install on the project directory.
That should install all required dependencies. If that don't work, then there are missing dependencies in your package.json file.
I you followed the tutorial there shouldn't be any problem.