Can't start project on react - reactjs

D:\IT\Practic work\React> create-react-app test
Creating a new React app in D:\IT\Practic work\React\test.
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:413:11)
at Object.spawn (node:child_process:700:9)
at spawn (C:\Users\Roman Borodai\AppData\Roaming\npm\node_modules\create-react-app\node_modules\cross-spawn\index.js:12:24)
at C:\Users\Roman Borodai\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:390:19
at new Promise (<anonymous>)
at install (C:\Users\Roman Borodai\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:341:10)
at C:\Users\Roman Borodai\AppData\Roaming\npm\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 test/ from D:\IT\Practic work\React
Done.

I faced the same issue and resolved it this way. Steps in sequence:
npm uninstall -g create-react-app
yarn global remove create-react-app (If yarn used)
npm update npx
npm audit fix --force
npx create-react-app your-app-name
I referred this post: https://betterprogramming.pub/what-to-do-if-create-react-app-doesnt-work-ad601b4c238

Related

NPX create-react-app with Error: spawn UNKNOWN

i install node.js then trying to create first react app by using npx create-react-app my-app in power shell and it cames following error.
PS C:\Users\Owner> npx create-react-app my-app
Creating a new React app in C:\Users\Owner\my-app.
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:420:11)
at Object.spawn (node:child_process:733:9)
at spawn (C:\Users\Owner\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\cross-spawn\index.js:12:24)
at C:\Users\Owner\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:383:19
at new Promise (<anonymous>)
at install (C:\Users\Owner\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:334:10)
at C:\Users\Owner\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:461: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\Owner
Done.
PS C:\Users\Owner>
I have been searching for solutions for hours and tried different methods but still didn't work. Can anyone please help?
node --version
v16.18.0
npm --version
8.19.2
Thanks in advance

Evertime I try to run my react app it gives me error

Whenever I try to run
npx create-react-app my-app
it gives me error.
I got stuck here can anyone help?
PS E:\ALI\Eziline work\React work> npx create-react-app my-app
Creating a new React app in E:\ALI\Eziline work\React work\my-app.
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:413:11)
at Object.spawn (node:child_process:713:9)
at spawn (C:\Users\Syed Taha Ali\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\cross-spawn\index.js:12:24)
at C:\Users\Syed Taha Ali\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:383:19
at new Promise (<anonymous>)
at install (C:\Users\Syed Taha Ali\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:334:10)
at C:\Users\Syed Taha Ali\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:461: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 E:\ALI\Eziline work\React work
Done.
This is the error I always face.
install node.js
if you already installed that clear your cache using
npm cache clean --force and try again

I am not able to launch npx create react app. What do i do?

Your environment has been set up for using Node.js 18.2.0 (x64) and npm.
C:\Users\aanan>npx create-react-app my-app
Creating a new React app in C:\Users\aanan\my-app.
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:413:11)
at Object.spawn (node:child_process:689:9)
at spawn (C:\Users\aanan\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\cross-spawn\index.js:12:24)
at C:\Users\aanan\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:383:19
at new Promise (<anonymous>)
at install (C:\Users\aanan\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:334:10)
at C:\Users\aanan\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:461:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errno: -4094,
code: 'UNKNOWN',
syscall: 'spawn'
}
Deleting generated file... package.json
Deleting my-app/ from C:\Users\aanan
Done.
C:\Users\aanan>

create-react-app Unexpected error. Please report it as a bug: Error: spawn UNKNOWN

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

unable to install react in ubuntu where error is displayed and I cant understand it?

when i type this command to install react package in ubuntu :npx create-react-app my-app
this error is displayed //
Creating a new React app in /home/x/Desktop/my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/rollup (over 30000ms)
npm ERR! A complete log of this run can be found in:
npm ERR! /home/x/.npm/_logs/2021-04-16T13_04_47_820Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting my-app/ from /home/x/Desktop
Done.
any suggestion please ?

Resources