facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.76k stars 26.87k forks source link

npx create-react-app is not working? why? #13704

Open backup-bs-1221 opened 6 days ago

backup-bs-1221 commented 6 days ago

For some reason when I tried to start a new project and run the npx command, i had met this issue. I tried to google this reason but no avail. It says issues with git so I tried to log in on terminal but it is still giving me the same error. Any idea why this would happen? Thanks.

====================================================================== root@tabulaRasa:/mnt/c/Users/tabul/OneDrive/Desktop/DTC web/temp# npx create-react-app your-project

Creating a new React app in C:\Users\tabul\OneDrive\Desktop\DTC web\temp\your-project.

Installing packages. This might take a couple of minutes. Installing react, react-dom, and react-scripts with cra-template...

added 1312 packages in 13s

259 packages are looking for funding run npm fund for details Git repo not initialized Error: Command failed: git --version at genericNodeError (node:internal/errors:983:15) at wrappedFn (node:internal/errors:537:14) at checkExecSyncError (node:child_process:888:11) at execSync (node:child_process:960:15) at tryGitInit (C:\Users\tabul\OneDrive\Desktop\DTC web\temp\your-project\node_modules\react-scripts\scripts\init.js:46:5) at module.exports (C:\Users\tabul\OneDrive\Desktop\DTC web\temp\your-project\node_modules\react-scripts\scripts\init.js:276:7) at [eval]:3:14 at runScriptInThisContext (node:internal/vm:209:10) at node:internal/process/execution:118:14 at [eval]-wrapper:6:24 { status: 1, signal: null, output: [ null, null, null ], pid: 9820, stdout: null, stderr: null }

Installing template dependencies using npm... Unknown command: "install$1$1"

Did you mean this? npm install # Install a package To see a list of supported npm commands, run: npm help npm install --no-audit --save @testing-library/jest-dom@^5.14.1 @testing-library/react@^13.0.0 @testing-library/user-event@^13.2.1 web-vitals@^2.1.0 failed

Gokul-sundar-softwaredev commented 2 days ago

I too face this issue when i try to install react I do this it worked for me 1.Install bun using npm npm install -g bun

  1. check you installed bun or not bun --version
  2. create react-app using bun bun create react-app your-project
AmnaMansha commented 2 days ago

Sometimes this type of error is due to the cache try to clean the cache then try again : 1-npm uninstall -g create-react-app 2-npm cache clean --force 3-npx create-react-app project_name --template all