Skip to content

npx create-react-app is not working #10132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Waqas-Akram opened this issue Nov 23, 2020 · 103 comments
Closed

npx create-react-app is not working #10132

Waqas-Akram opened this issue Nov 23, 2020 · 103 comments

Comments

@Waqas-Akram
Copy link

$ npx create-react-app my-app

You are running create-react-app 4.0.0, which is behind the latest release (4.0.1).

We no longer support global installation of Create React App.

Please remove any global installs with one of the following commands:

  • npm uninstall -g create-react-app
  • yarn global remove create-react-app

The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/

npm ERR! code 1
npm ERR! path C:\Users\User\Desktop
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c create-react-app my-app

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache_logs\2020-11-23T18_27_48_723Z-debug.log

@borja-munoz
Copy link

I had the same error and the solution for me was to remove the npm cache folder:
https://docs.npmjs.com/cli/v6/configuring-npm/folders#cache

@imrishav
Copy link

I solved this using the following command.

npm uninstall -g create-react-app

then

npm install -g create-react-app

@Waqas-Akram
Copy link
Author

Waqas-Akram commented Nov 26, 2020 via email

@svadr
Copy link

svadr commented Nov 27, 2020

Worked for me as well, thank you.

I solved this using the following command.

npm uninstall -g create-react-app

then

npm install -g create-react-app

@SamuliPeltonen
Copy link

I solved this using the following command.

npm uninstall -g create-react-app

then

npm install -g create-react-app

Thanks for this! Worked for me too.

@salimdason
Copy link

  1. First, you'll need to uninstall "create-react-app" using the "npm uninstall -g create-react-app" command.
  2. Run "npx create-react-app my-app" each time you want to create a new React app.
    Hope you find this helpful

@devnuru
Copy link

devnuru commented Nov 30, 2020

I solved this using the following command.

npm uninstall -g create-react-app

then

npm install -g create-react-app

It's not working for me. Please help me!😢
Again I saw this error----

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path D:\udemy/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'D:\udemy\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache_logs\2020-11-30T20_18_36_036Z-debug.log

@salimdason
Copy link

I solved this using the following command.
npm uninstall -g create-react-app
then
npm install -g create-react-app

It's not working for me. Please help me!😢
Again I saw this error----

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path D:\udemy/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'D:\udemy\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache_logs\2020-11-30T20_18_36_036Z-debug.log

"npx create-react-app my-app" instead of "npm install -g create-react-app"

@reach009
Copy link

reach009 commented Dec 2, 2020

**npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/reach/Documents/Personal Projects/Service_Project/iCareerZ/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/reach/Documents/Personal Projects/Service_Project/iCareerZ/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/reach/.npmrc/_logs/2020-12-02T01_50_49_350Z-debug.log**

I also got the same problem. I try "npx create-react-app my-app" and it seems like not working. Please help

@MahrezDev
Copy link

npm init -y
npx create-react-app project1

@tomcavanaugh
Copy link

I had to run both of the following commands to resolve this issue.

  • npm uninstall -g create-react-app
  • yarn global remove create-react-app

Possibly the wording on the following error message could be updated to indicate that both of these commands may be required.

Change:
Please remove any global installs with one of the following commands:

To:
Please remove any global installs with one or both of the following commands:

@adccb
Copy link

adccb commented Dec 2, 2020

update

nope, this was my registry being poorly set up—i was trying to hit my company's scoped registry, which hadn't yet ingested [email protected]. i'm all set.

original post

also chiming in here. i think there's a dependency issue somewhere, as i've confirmed this is happening on node v12.18.0 and v15.3.0:

acrossan/src → node -v
v15.3.0

acrossan/src → npm list -g | grep 'create-react-app'

acrossan/src → npx create-react-app test
Need to install the following packages:
  create-react-app
Ok to proceed? (y) y

Creating a new React app in /Users/acrossan/src/test.

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

npm ERR! code ETARGET
npm ERR! notarget No matching version found for no-case@^3.0.4.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/acrossan/.npm/_logs/2020-12-02T18_24_01_607Z-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 test/ from /Users/acrossan/src
Done.
npm ERR! code 1
npm ERR! path /Users/acrossan/src
npm ERR! command failed
npm ERR! command sh -c create-react-app test

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/acrossan/.npm/_logs/2020-12-02T18_24_01_670Z-debug.log

acrossan/src → npm i -g create-react-app

added 67 packages in 828ms

4 packages are looking for funding
  run `npm fund` for details
acrossan/src → create-react-app test

Creating a new React app in /Users/acrossan/src/test.

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

npm ERR! code ETARGET
npm ERR! notarget No matching version found for no-case@^3.0.4.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/acrossan/.npm/_logs/2020-12-02T18_28_06_026Z-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 test/ from /Users/acrossan/src
Done.

@reach009
Copy link

reach009 commented Dec 3, 2020

I am able to solve the problem by first trying to uninstall the npm globally, update the npm, clear the cache then using npx command to create React app.

The command is as below:

npm uninstall -g create-react-app && npm i -g npm@latest && sudo npm cache clean -f && npx create-react-app my-app

This is taken from one of the Stack Overflow posts.

https://stackoverflow.com/questions/64963796/create-react-app-is-not-working-since-version-4-0-1/65043610

@MahrezDev
Copy link

reach009 thnks

@kusaljay
Copy link

kusaljay commented Dec 4, 2020

I am able to solve the problem by first trying to uninstall the npm globally, update the npm, clear the cache then using npx command to create React app.

The command is as below:

npm uninstall -g create-react-app && npm i -g npm@latest && sudo npm cache clean -f && npx create-react-app my-app

This is taken from one of the Stack Overflow posts.

https://stackoverflow.com/questions/64963796/create-react-app-is-not-working-since-version-4-0-1/65043610

This worked for me. Thank you very much @reach009

@trydalch
Copy link

trydalch commented Dec 4, 2020

Worked for me as well. Don't forget to update npm. I initially tried all the steps besides that and it kept thinking I still had create-react-app installed globally even though I didn't.

@ImBobot
Copy link

ImBobot commented Dec 5, 2020

I don't know about this one, but after installing npm i -g yarn and then that's the time I started building project using
npx create-react-app my_app It works for me. Oh update npm.

@jaronsummers
Copy link

jaronsummers commented Dec 6, 2020

I have never had create-react-app installed and still receive this error. In fact, I have no npm packages installed at all, but it still warns that I am running 4.0.0, and that global installation is no longer supported, and then exits.

node 14.15.0, have tried clearing the npm cache.

@kvaropil
Copy link

kvaropil commented Dec 8, 2020

Running on macOS Catalina 10.15.7
$ node -v >> v14.15.1
$ npm -v >> 6.14.8

I am facing the same issue mentioned in the first post.

I have tried different versions of Node and NPM, npm uninstall -g create-react-app (although never installed CRA globally on my current machine), clear npm cache, reinstall the entire Node. My $ which create-react-app returns nothing, $ npm list -g --depth=0 returns

/Users/kvaropil/.nvm/versions/node/v14.15.1/lib
└── [email protected]

I am really out of ideas how to fix this issue.

@baalansellers
Copy link

I had the same error and the solution for me was to remove the npm cache folder:
https://docs.npmjs.com/cli/v6/configuring-npm/folders#cache

This worked for me too, however, I went into ~/.npm/_npx/<cache hash>/node_modules and deleted the create-react-app directory specifically. Then, just to be very sure, I also manually edited ~/.npm/_npx/<cache hash>/package.json and set the version for create-react-app to 4.0.1, even though it was marked with a carrot already.

Then I ran npx create-react-app ... again, it prompted to install it, hit "y", and I was back in business.

@jmischka
Copy link

I've also run into the same problem as others above and have been going around in circles for 2 hours. My steps:
'npm uninstall -g create-react-app' (even though I never installed create-react-app globally),
'npm cache clean --force' (I also tried 'sudo npm cache clean -f')
then 'npx create-react-app my-app.'

Yet, I'm still running an error that I have it globally installed:
You are running create-react-app 4.0.0, which is behind the latest release (4.0.1).
We no longer support global installation of Create React App.

I'm at a loss and stuck in what feels like a maze. My next step is to manually start deleting and files as baalansellers suggests, but I don't think that should be necessary.

@Ivy2012
Copy link

Ivy2012 commented Dec 21, 2020

I am able to solve the problem by first trying to uninstall the npm globally, update the npm, clear the cache then using npx command to create React app.

The command is as below:

npm uninstall -g create-react-app && npm i -g npm@latest && sudo npm cache clean -f && npx create-react-app my-app

This is taken from one of the Stack Overflow posts.

https://stackoverflow.com/questions/64963796/create-react-app-is-not-working-since-version-4-0-1/65043610

This did the trick for me. Thanks!

@DashBarkHuss
Copy link

For me I got the same error even though create-react-app was installed in a parent directory, not globally. So I ran npm uninstall create-react-app without the -g flag and it worked.

@jmischka
Copy link

For those who ran into similar issues I had, baalansellers (3 above) had the answer. Thanks!
"... ~/.npm/_npx//node_modules and deleted the create-react-app directory specifically. Then, just to be very sure, I also manually edited ~/.npm/_npx//package.json and set the version for create-react-app to 4.0.1, even though it was marked with a carrot already.

Then I ran npx create-react-app ... again, it prompted to install it, hit "y", and I was back in business... "

@1-pro
Copy link

1-pro commented Jan 25, 2021

I am able to solve the problem by first trying to uninstall the npm globally, update the npm, clear the cache then using npx command to create React app.

The command is as below:

npm uninstall -g create-react-app && npm i -g npm@latest && sudo npm cache clean -f && npx create-react-app my-app

This is taken from one of the Stack Overflow posts.

https://stackoverflow.com/questions/64963796/create-react-app-is-not-working-since-version-4-0-1/65043610

it isn't working for me, please help nothing is working for me

@reach009
Copy link

@1-pro: Can you share more details on the error messages you got?

I am able to solve the problem by first trying to uninstall the npm globally, update the npm, clear the cache then using npx command to create React app.
The command is as below:
npm uninstall -g create-react-app && npm i -g npm@latest && sudo npm cache clean -f && npx create-react-app my-app
This is taken from one of the Stack Overflow posts.
https://stackoverflow.com/questions/64963796/create-react-app-is-not-working-since-version-4-0-1/65043610

it isn't working for me, please help nothing is working for me

@lonaveer
Copy link

==================================
First Time -> I Found Error (Use Git Bash)

$ npx create-react-app test

Creating a new React app in C:\React_TEE\test.

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

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: [email protected]
npm ERR! node_modules/type-fest
npm ERR! type-fest@"^0.11.0" from [email protected]
npm ERR! node_modules/ansi-escapes
npm ERR! ansi-escapes@"^4.3.1" from [email protected]
npm ERR! node_modules/jest-watch-typeahead
npm ERR! jest-watch-typeahead@"0.6.1" from [email protected]
npm ERR! node_modules/react-scripts
npm ERR! react-scripts@"" from the root project
npm ERR! ansi-escapes@"^4.2.1" from @jest/[email protected]
npm ERR! node_modules/@jest/core
npm ERR! @jest/core@"^26.6.0" from [email protected]
npm ERR! node_modules/jest
npm ERR! jest@"26.6.0" from [email protected]
npm ERR! node_modules/react-scripts
npm ERR! 1 more (jest-watch-typeahead)
npm ERR! 1 more (jest-cli)
npm ERR! 2 more (jest-watcher, terminal-link)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional type-fest@"^0.13.1" from @pmmmwh/react-refresh-webpack-plu
[email protected]
npm ERR! node_modules/@pmmmwh/react-refresh-webpack-plugin
npm ERR! @pmmmwh/react-refresh-webpack-plugin@"0.4.2" from [email protected]
npm ERR! node_modules/react-scripts
npm ERR! react-scripts@"
" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\Miku\AppData\Local\npm-cache\eresolve-report.txt for a ful
l report.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Miku\AppData\Local\npm-cache_logs\2021-01-29T19_19_32_095
Z-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 test/ from C:\React_TEE
Done.
npm ERR! code 1
npm ERR! path C:\React_TEE
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c create-react-app test

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Miku\AppData\Local\npm-cache_logs\2021-01-29T19_19_32_148
Z-debug.log

==================================
I Fix Error (Use Git Bash)

npm uninstall create-react-app
npm uninstall -g create-react-app
npm i -g npm@latest
npm cache clean -f
npx create-react-app my-app
.
.
.
Happy hacking!

@Ro-Bert-Web
Copy link

I've tried all of these. My message keeps saying I'm using 4.0.1 but need 4.0.2 and to uninstall globally. When I uninstall globally, it says a message like "up to date in " and the message still pops up when I run npx create-react-app.
Further more, the folder ". ~/.npm/_npx//node_modules" does not exist and so I can't delete the create-react-app file

@cgburgos
Copy link

cgburgos commented Jan 6, 2022

It may sound really dumb, but try running your terminal with admin privileges

@reggiestrain
Copy link

Hey guys, I think it's unanimous the uninstall and reinstalling create-react-app works like a charm. It certainly
worked for me.

Happy coding

@reggiestrain
Copy link

Oh....I forgot to give props to @imrishav

Thanks @imrishav

@hanilim
Copy link

hanilim commented Jan 12, 2022

I have had this issue on node v14 on Mac OS. Running npm uninstall -g create-react-app and then using npx would still give the message A template was not provided. This is likely because you're using an outdated version of create-react-app.

I resolved it by following the steps here:
#8097

Adding here in case it helps someone.

@gurjeetsinghvirdee
Copy link

Try this npx create-react-app@latest your-project-name --use-npm it works for me

@YaroslavShilov
Copy link

I solved this using the following command.

npm uninstall -g create-react-app

then

npm install -g create-react-app

Thanks for sharing!!!!

@nullakan
Copy link

nullakan commented Jan 25, 2022

Try this npx create-react-app@latest your-project-name --use-npm it works for me

This is the cleanest solution that worked for me, thanks @gurjeetsinghvirdee

@moarifur
Copy link

moarifur commented Feb 9, 2022

If npx create-react-app is not working then do this

npm uninstall -g create-react-app
npm install -g create-react-app
npx create-react-app my-app
cd my-app
npm start

@sokoya
Copy link

sokoya commented Feb 18, 2022

I tried several times using the npm uninstall and each time the subsequent create-react-app failed. The solution for me was to use: yarn global remove create-react-app

This finally worked for me

@caleb531
Copy link

I'll add that npx create-react-app@latest your-project-name did the trick for me. Didn't need the --use-npm flag.

@haykmatshkalian
Copy link

npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/electron-to-chromium: Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\лрроопр\AppData\Local\npm-cache_logs\2022-07-25T19_13_34_028Z-debug-0.log

Can you help me?
I have that error

@haykmatshkalian
Copy link

or it show me that

npm ERR! code ECONNRESET
npm ERR! syscall read
npm ERR! errno ECONNRESET
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/scheduler: read ECONNRESET
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\лрроопр\AppData\Local\npm-cache_logs\2022-07-25T19_43_33_201Z-debug-0.log

@gurjeetsinghvirdee
Copy link

or it show me that

npm ERR! code ECONNRESET npm ERR! syscall read npm ERR! errno ECONNRESET npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/scheduler: read ECONNRESET npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config'

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\лрроопр\AppData\Local\npm-cache_logs\2022-07-25T19_43_33_201Z-debug-0.log

Try this
Source: Stackoverflow
Screenshot 2022-07-26 024429

@bitwhys
Copy link

bitwhys commented Aug 22, 2022

just don't use npx for create-react-app.

@lnavarroa
Copy link

lnavarroa commented Oct 6, 2022

hi, i have try everything here, but nothing work for me :( i have a vps running with debian 11, any idea?

@MaoChristopher
Copy link

maybe the network

@sandeedSD
Copy link

I have tried these all method but could not working, any other solution for it

@chammi-hansana
Copy link

Use a different network: For example, you can try connecting to a different Wi-Fi network or using a mobile hotspot.

Hope this should help you.This Works For me.

@bhaltair
Copy link

bhaltair commented Jul 5, 2023

try
npx clear-npx-cache

and then

npx create-react-app your-app

@Saad-Ghauri
Copy link

yessss yesssss yesssssss yahhhoooooooo!!!!!! its working thanks you soooo much for savingggggg im so exited got emotionallll

@yimeramedie
Copy link

Also worked for me
npm uninstall -g create-react-app

then
npm install -g create-react-app

@renatoshi
Copy link

I solved this using the following command.

npm uninstall -g create-react-app

then

npm install -g create-react-app

Best Solution, work for me, try this one.

@TheDext
Copy link

TheDext commented Dec 14, 2023

Я решил это, используя следующую команду.

npm uninstall -g create-react-app

затем

npm install -g create-react-app

i love u <3

@thisiskhandev
Copy link

I solved this using the following command.

npm uninstall -g create-react-app

then

npm install -g create-react-app

I had a similar issue too.

npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\USERNAME\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\USERNAME\AppData\Roaming\npm'
npm ERR! enoent This is related to npm not being able to find a file.

This solution resolves my issue too.. Thank you for sharing ❤

@Ritesh2211
Copy link

npm install -g create-react-app

Thanks worked for me too

@sk2539
Copy link

sk2539 commented May 21, 2024

This is what is happening for me, does anyone know how to fix it?

Screenshot 2024-05-21 023612

@Ritesh2211
Copy link

try npm create-react-app my-app

@sk2539
Copy link

sk2539 commented May 21, 2024

try npm create-react-app my-app

This outputted Unknown command: "create-react-app"

@saitejayelubolu
Copy link

the first step is to locate your project folder

then run these commands one by one

npm uninstall react react-dom

then

npm install react@18 react-dom@18

then

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

then

npm start

here what we are doing is uninstalling react19 and installing react18.

or you can go with this YouTube link: https://youtu.be/mUlfo5ptm1o?si=hYHTwc7hApEXzPX5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests