Uğur Yeşilyurt
Uğur Yeşilyurt

Reputation: 1349

'create-react-app' is not recognized as an internal or external command

I am trying to set up react app using create-react-app command on windows pc. I already used it on my mac computer, and it works well. But I encounter a problem. Here my steps on command line. Am i missing something?

C:\Windows\system32>cd C:\Users\ugur\Desktop\deneme

C:\Users\ugur\Desktop\deneme>npm init


This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See 'npm help json' for definitive documentation on these fields
and exactly what they do.

Use 'npm install <pkg> --save' afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
name: (deneme)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
license: (ISC)
About to write to C:\Users\ugur\Desktop\deneme\package.json:

{
   "name": "deneme",
   "version": "1.0.0",
   "description": "",
   "main": "index.js",
   "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
   },
   "author": "Ugur <[email protected]> (http://www.abc.com.tr)",
   "license": "ISC"
}


Is this ok? (yes)

C:\Users\ugur\Desktop\deneme>npm install -g create-react-app
C:\Users\ugur\AppData\Roaming\npm\create-react-app -> C:\Users\ugur\
AppData\Roaming\npm\node_modules\create-react-app\index.js
C:\Users\ugur\AppData\Roaming\npm
`-- [email protected]
  +-- [email protected]
  | +-- [email protected]
  | +-- [email protected]
  | +-- [email protected]
  | | `-- [email protected]
  | +-- [email protected]
  | `-- [email protected]
  +-- [email protected]
  | +-- [email protected]
  | | +-- [email protected]
  | | `-- [email protected]
  | `-- [email protected]
  |   `-- [email protected]
  +-- [email protected]
  `-- [email protected]


C:\Users\ugur\Desktop\deneme>create-react-app new_app

'create-react-app' is not recognized as an internal or external command, operable program or batch file.

Also npm configuration path is like

C:\Users\ugur\AppData\Roaming\npm\node_modules\create-react-app\

Upvotes: 51

Views: 129744

Answers (30)

SELA
SELA

Reputation: 6823

I wanted to create a react app with a typescript template. Posting this as a reference for anyone interested in achieving the above. I am using node v21.4.0

The below steps worked for me :

  1. Install create-react-app globally via the following command.

    npm install -g create-react-app

  2. then enter create-react-app command with --template flag set to typescript with your app name.

    create-react-app <your-app-name> --template typescript

Happy coding...

Upvotes: 0

Huseyin
Huseyin

Reputation: 567

My problem was my Windows Account name. I changed like this Hüseyin Baduk -> huseyinbaduk. But you need to be careful this change process corrupt your other applications use user data in C:/Users/%/

Upvotes: 0

Đ&#224;o Tuy&#234;n
Đ&#224;o Tuy&#234;n

Reputation: 131

issue: may be you miss somethings library or dependency solution: npm i react-app-env

Upvotes: 0

Mayank Goyal
Mayank Goyal

Reputation: 63

just do this:

npm i npx then npx create-react-app <app-name

Upvotes: 3

Farhan
Farhan

Reputation: 1

Try This.

npm uninstall -g create-react-app

or

yarn global remove create-react-app

it will solve issue

Upvotes: 0

Janaka R Rajapaksha
Janaka R Rajapaksha

Reputation: 3754

documentation says: npm init react-app my-app

reference: https://github.com/facebook/create-react-app

Upvotes: 1

learningto_code
learningto_code

Reputation: 11

I solved my problem by following steps

  1. npm install -g create-react-app To install react app globally
  2. create-react-app version To check if it is installed and if its installed then what's the version.
  3. create-react-app [name]
  4. cd [name]
  5. npm start

Upvotes: 1

Randomthoughts
Randomthoughts

Reputation: 1

This worked for me, seems the create react app has version issue, adding @latest solves it, installing it in local is by no means useful as the use of npx is to get latest version from remote repository that from local.

npx create-react-app@latest react-webdev-course

Upvotes: 0

Prajna
Prajna

Reputation: 11

Adding npx to the command solves the problem and react app is created e.g:

$ npx create-react-app my-react-app

Upvotes: 1

Ubaidullah Anwar
Ubaidullah Anwar

Reputation: 21

I was trying to create an app on my PC with Windows PowerShell. I tried updating and setting up environment variables accordingly. But nothing worked for me until I followed these steps.

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

and then it started working. Use these commands in the same sequence.

Upvotes: 0

Abhishek Kochar
Abhishek Kochar

Reputation: 27

Someone who is still having this issue, Go to C:\Users\user\AppData\Roaming\npm- check if .cmd is create-react- app or creact-react-native-app.

Mine was the latter.

Also, make sure you don't have two different version installed.

Upvotes: 0

Sid
Sid

Reputation: 133

I faced the same issue despite having

npm install create-react-app --global

Later tried

npm init react-app projectname

This worked for me and it created a React project. Also this worked

npx create-react-app projectname

Upvotes: 5

selharem
selharem

Reputation: 74

I solved the problem by using Node.js command prompt as an administrator

Upvotes: 0

Ali Waqas
Ali Waqas

Reputation: 335

I reinstalled node.js and added the path given by npm root -g command to my path variable to get it working.

Upvotes: -2

Tiago Couto
Tiago Couto

Reputation: 61

Another one that might work is to use Powershell and type:

npx create-react-app new_app --use-npm

Upvotes: 6

TonyStark
TonyStark

Reputation: 51

For me just create-react-app project-name worked after adding path C:\Users\user\AppData\Roaming\npm\node_modules to my environment variables.

Upvotes: 0

JHM16
JHM16

Reputation: 798

User following command

npx create-react-app my-app

Upvotes: 1

kelvin nyadzayo
kelvin nyadzayo

Reputation: 93

This is a windows variable path problem, i have faced the same problem recently, the following are possible root cause of the problem , installing node via nvm(node version manager) so to solve the issue in this case you after running npm install -g create-react-app got to the location in my case C:\Users\pc\AppData\Roaming\npm in the copy create-react-app to C:\Users\pc\AppData\Roaming\nvm\v12.18.3 and also move the folder in node_module folder called create-react-app to the specific version you are using under nvm , after that you should be able to use create-react-app without and issue. i hope this will help someone

Upvotes: 1

ADARSH KUNWAR
ADARSH KUNWAR

Reputation: 167

Use npx create-react-app my-app. This will solve any issue with the system path variable.

React GitHub documentation suggests this as well. Read Here

Upvotes: 10

Jacman
Jacman

Reputation: 1592

Do the following from TERMINAL:

  • cd myReactApp
  • npx create-react-app .

This should work!

Upvotes: 1

Wathsala Karunathilake
Wathsala Karunathilake

Reputation: 1508

Try with this npx create-react-app my-app

Upvotes: 136

Arjun Kushwah
Arjun Kushwah

Reputation: 1

Environment node -v: v8.9.3 npm -v:4.6.1 yarn --version (if you use Yarn): npm ls react-scripts (if you haven’t ejected): C:\Users\chacker\my-react-app>npm ls react-scripts [email protected] C:\Users\chacker\my-react-app `-- (empty) Then, specify:

Operating system: windows 7 Browser and version (if relevant): Steps to Reproduce (Write your steps here:)

npm install -g create-react-app log-> C:\Users\chacker\my-react-app>npm install -g create-react-app C:\Users\chacker\AppData\Roaming\npm\create-react-app -> C:\Users\chacker\AppData\R aming\npm\node_modules\create-react-app\index.js C:\Users\chacker\AppData\Roaming\npm `-- [email protected] create-react-app my-app

Upvotes: 0

Shishay Ghebrehiwet
Shishay Ghebrehiwet

Reputation: 359

simply putting 'npx' in front of the command will solve this if you are running older version of node.

try this and it will work fine.

npx create-react-app [yourProjectName]

Upvotes: 18

JHM16
JHM16

Reputation: 798

If above solution not working try this on it will work 100%

0)first of all install package "npm create-create-app -g" or "yarn add create-react-app" then

1)open cmd and type "npm root -g" this command will give you path of node_model directory for global packages

2) copy that path only upto npm directory eg.C:\Users\vchaudhari\AppData\Roaming\npm

3) open environmental variables in windows and pest that command in that save it .

4) close current cmd and open new cmd and use command "create-react-app demoapp"

5) Enjoy :-)

Upvotes: 0

Sourabh Dubey
Sourabh Dubey

Reputation: 406

First Check your Node version. if your node version is 8 or greater then 8 then use
'npx create-react-app my-app'

In the above version we need to change only one word that is npx

You don't need to do another things. I hope this will help you

Upvotes: 8

BHP
BHP

Reputation: 1

I solved problem by following below steps

1) open Node.js command prompt

2) Then type "npm install create-react-app -g" (g for global access) command to install create-react-app

3) Then type "npm install create-react-native-app -g" (g for global access) command to install create-react-native-app

Follow step #2 for use create-react-app

Follow step #3 only if you want to use create-react-native-app otherwise its optional.

Upvotes: -2

By installing react globally this error can be solved for those who didn't get even after the environmental variable is set. npm i -g create-react-app . Now the modules will be installed.

Upvotes: 0

Marina ES
Marina ES

Reputation: 270

  • Run : npx install create-react-app nameOfYourFolder instead of npm install create-react-app nameOfYourFolder (npx comes with npm 5.2+ and higher)
  • Then : cd nameOfYourFolder
  • Then run : npm start

You can find more in React documentation here

Upvotes: 2

Vick Sain
Vick Sain

Reputation: 153

I also get same problem but I resolve it by following steps

  1. Check your global directory by using command npm root -g
  2. check the folder, will it have .cmd of your installed packages.
  3. If yes, Please copy the path of folder and put in path of user variables.

Thanks

Upvotes: 3

Richu Jose
Richu Jose

Reputation: 19

This is the issue is mainly caused by two reasons:

  1. Path variable issue
  2. Npm version issue

Add C:\Users\ugur\AppData\Roaming\npm to Windows PATH variable and upgrade npm version to 5.5.1

Upvotes: 1

Related Questions