Rahul Yadav
Rahul Yadav

Reputation: 3197

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?

Upvotes: 5

Views: 3363

Answers (2)

Dan Abramov
Dan Abramov

Reputation: 268255

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

Upvotes: 7

Siya Mzam
Siya Mzam

Reputation: 4705

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.

Upvotes: 3

Related Questions