Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Creating a new project with npm <= 5.2

If you use npm 5.1 or earlier, you can't use npx. Instead, install create-react-app globally:

npm install -g create-react-app

Now you can run:

create-react-app my-app
@d0bbl
Copy link

d0bbl commented Nov 6, 2021

running "npm install -g create-react-app my-app" kinda defeats the purpose of using npx don't you think? Because i shouldn't have to install the create-react-app package to my machine first, npx should be able to fetch the package from npm's remote package library right? Don't know why my npx works for other packages but not the create-react-app one

@mdrazu722901
Copy link

mdrazu722901 commented Dec 15, 2021

thanks from Bangladesh for this helps

@FelipeDeveloperFullStack

Thank you so much. It was helpful me.

@mohamed-oukhlidja
Copy link

mohamed-oukhlidja commented Dec 16, 2021

شكرا

@EliavYair1
Copy link

EliavYair1 commented Dec 20, 2021

thank you that was very helpful!

@katana9108
Copy link

katana9108 commented Dec 22, 2021

Thank!!!

@kubby159
Copy link

kubby159 commented Dec 28, 2021

thankyou!

@daliayan
Copy link

daliayan commented Jan 6, 2022

Thank you very much! The new Node update had thrown me off for a minute.

@koazie
Copy link

koazie commented Jan 8, 2022

I was lost for a hot minute when I saw the message, but thank you so much for this.

@mysticBel
Copy link

mysticBel commented Jan 9, 2022

Thank you so much !! 😂

@gamafedev
Copy link

gamafedev commented Jan 9, 2022

Thanks. its help

@Riad2019
Copy link

Riad2019 commented Jan 11, 2022

thanks

@Black00363636summers-1991

Hi guys I have been having troubles with npm install -g create-react-app for a long time. Every time I do npm or npx on my command prompt this is what shows up after 4-5 hours.

"C:\Users\User>npm uninstall -g create-react-app

removed 67 packages, and audited 1 package in 4s

found 0 vulnerabilities

C:\Users\User>npx create-react-app my-app

Creating a new React app in C:\Users\User\my-app.

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

npm ERR! code ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/jest-resolve/-/jest-resol
ve-27.4.6.tgz failed, reason: getaddrinfo ENOTFOUND mydomain
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 settin
gs.
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\User\AppData\Local\npm-cache_logs\2022-02-25T22_39_55_041
Z-debug.log

Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-dom re
act-scripts cra-template has failed.

Deleting generated file... package.json
Deleting my-app/ from C:\Users\User
Done.

C:\Users\User>"

Could someone please help me on how to work this out for me as I had no luck for the past month. Thanks.

@yxynicole
Copy link

yxynicole commented Apr 6, 2022

thanks

@kawcher-habib
Copy link

kawcher-habib commented Apr 6, 2022

Thank you

@ANTONIOISC
Copy link

ANTONIOISC commented Apr 12, 2022

nategentile@MacBook-Pro-de-Nate React % npx create-react-app intro-javascript

Creating a new React app in /Users/nategentile/Desktop/React/intro-javascript.

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

added 1355 packages in 42s

171 packages are looking for funding
run npm fund for details

Initialized a git repository.

Installing template dependencies using npm...
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: intro-javascript@0.1.0
npm ERR! Found: react@18.0.0
npm ERR! node_modules/react
npm ERR! react@"^18.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"<18.0.0" from @testing-library/react@12.1.5
npm ERR! node_modules/@testing-library/react
npm ERR! @testing-library/react@"^12.0.0" 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 /Users/nategentile/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:

@ANTONIOISC
Copy link

ANTONIOISC commented Apr 12, 2022

Captura de Pantalla 2022-04-12 a la(s) 12 09 42

Tengo este error pero no puedo resolverlo
Es que estoy en una macbook pro M1

@ayman-salah
Copy link

ayman-salah commented Apr 12, 2022

thank you ,

@jandresengin
Copy link

jandresengin commented Apr 14, 2022

Captura de Pantalla 2022-04-12 a la(s) 12 09 42

Tengo este error pero no puedo resolverlo Es que estoy en una macbook pro M1

After this error type the follow line, and it will work:

npm install --no-audit --save @testing-library/jest-dom@^5.14.1 @testing-library/react@^12.0.0 @testing-library/user-event@^13.2.1 web-vitals@^2.1.0

@cyber0100
Copy link

cyber0100 commented Apr 16, 2022

thanks bro !****

@tere79purple
Copy link

tere79purple commented Apr 18, 2022

Hi guys I have been having troubles with npm install -g create-react-app for a long time. Every time I do npm or npx on my command prompt this is what shows up after 4-5 hours.

"C:\Users\User>npm uninstall -g create-react-app

removed 67 packages, and audited 1 package in 4s

found 0 vulnerabilities

C:\Users\User>npx create-react-app my-app

Creating a new React app in C:\Users\User\my-app.

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

npm ERR! code ENOTFOUND npm ERR! syscall getaddrinfo npm ERR! errno ENOTFOUND npm ERR! network request to https://registry.npmjs.org/jest-resolve/-/jest-resol ve-27.4.6.tgz failed, reason: getaddrinfo ENOTFOUND mydomain 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 settin gs. 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\User\AppData\Local\npm-cache_logs\2022-02-25T22_39_55_041 Z-debug.log

Aborting installation. npm install --no-audit --save --save-exact --loglevel error react react-dom re act-scripts cra-template has failed.

Deleting generated file... package.json Deleting my-app/ from C:\Users\User Done.

C:\Users\User>"

Could someone please help me on how to work this out for me as I had no luck for the past month. Thanks.

Re-start your computer, Windows. Use, gitbash or cmd for the commands, don´t use power shell

@mallika2016
Copy link

mallika2016 commented Apr 24, 2022

"npx create-react-app doesn't work for me. I get this feedback image I already tried reinstalling the latest version of node using nvm-windows. This is what the path of my environment variable looks like, automatically added by nvm; image If i first do "npm i -g create-react-app" before the npx command it works, but i shouldn't have to do that right?

@rimjhim07
Copy link

rimjhim07 commented Apr 25, 2022

Run

  1. npm install create-react-app
  2. npx create-react-app project-name.

It will probably work without the -g flag.

yeah it worked, thanks !!

@saadamjad
Copy link

saadamjad commented May 5, 2022

Run

  1. npm install create-react-app
  2. npx create-react-app project-name.

It will probably work without the -g flag.

its worked !!

@elladqa
Copy link

elladqa commented May 22, 2022

Run

  1. npm install create-react-app
  2. npx create-react-app project-name.

It will probably work without the -g flag.

thank you!

@Yanneth17
Copy link

Yanneth17 commented May 26, 2022

Thank you

@andersondcribeiro
Copy link

andersondcribeiro commented May 29, 2022

Thanks @gaearon!

@cuteBear85
Copy link

cuteBear85 commented Jun 2, 2022

Thanks!

@BRIJESHJENA
Copy link

BRIJESHJENA commented Jun 7, 2022

You are running create-react-app` 4.0.3, which is behind the latest release (5.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
    `

@peppe804
Copy link

peppe804 commented Jun 25, 2022

Thanks a lot for this post, Its help

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