Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

installed create-react-app without -g

I have installed create-react-app without -g

C:\Users\user1\projects\react>npm install create-react-app

but when I run

C:\Users\user1\projects\react>create-react-app my-app1

I get the following error

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

can anyone please help me understand the role of -g flag

what if I dont want to install it globally?

How do I make it work without installing globally?

like image 332
Rahul Yadav Avatar asked Nov 20 '17 17:11

Rahul Yadav


2 Answers

what if I dont want to install it globally?

How do I make it work without installing globally?

The package is designed to be installed globally. Please use it as intended.

If you don't want to permanently install it, in recent Node versions you can actually run it without installing through npx:

npx create-react-app my-app
like image 199
Dan Abramov Avatar answered Sep 23 '22 20:09

Dan Abramov


If you have installed any npm module locally it will be stored in the .bin folder inside node_modules. To use this, you would have to reference node_modules/.bin/the binary to run. If installed globally, the module's binary will be stored wherever your OS stores executables that are run from the terminal, in Unix/Linux, for instance, it's usually something like /usr/bin(not absolutely sure). This is why installing something locally won't run by simply typing out its name in the terminal. Rather reference it absolutely like this node_modules/bin/the binary to run.

like image 42
Siya Mzam Avatar answered Sep 22 '22 20:09

Siya Mzam