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?
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
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With