Reputation: 2211
I know I've done it before but I can't seem to find the answer anywhere. I want to run create-react-app without creating a whole other folder within the folder I'm already in. I believe it is just an additional flag appended to the command.
Upvotes: 218
Views: 213970
Reputation: 318
Creating a text project in the current directory you're in is as simple as running the command below:
npx create-react-app .
Or this when you have create react app installed globally.
create-react-app .
One important thing that I want you to notice is the full stop (period) at the end of the command. The full stop indicates that you want to create the app in the current directory.
I hope this helps
Upvotes: 5
Reputation: 189
Create React app with typescript in current folder
npx create-react-app . --template typescript
or
npx create-react-app ./ --template typescript
If you are planning to use scss, you need to install node sass as below
yarn add node-sass --save
Upvotes: 0
Reputation: 45
Open the folder -> go to the terminal and Write:- npx create-react-app "your app name"
Example:
npx create-react-app xyz
press enter. This will automatically create the new app.
Upvotes: -1
Reputation: 51
First, go to the directory where you want to create react app.
Then run the command npx create-react-app .
I am simply putting a dot(.) instead of the project name.
Upvotes: 5
Reputation: 21
*create-react-app .
I know I've done it before but I can't seem to find the answer anywhere. I want to run create-react-app without creating a whole other folder within the folder I'm already in. I believe it is just an additional flag appended to the command.
Upvotes: 0
Reputation: 627
react-app .` will work but remember due to their naming restrictions you cannot have the first letter capital so remember to change the folder name to lower case before adding that
Upvotes: 0
Reputation: 51
You can create a new React app in the current directory by writing ./ instead of a project name.
Run that command in Your terminal>
npx create-react-app ./
ex.-
PS E:\React Course\covid-19-state-vice-cases>npx create-react-app ./
Upvotes: 3
Reputation: 687
This works for me.
npx create-react-app .
npx create-react-app .
N.B:
If you install create-react-app
package directly via npm by this command npm install create-react-app
, then you have to run the following command to create react app in current directory create-react-app .
(no need to add npx then).
Upvotes: 2
Reputation: 129
create-react-app .
I've found this very useful for separating my client and server into individual directories underneath a parent project directory. This way you can keep your server and client seperate and easily know which API's are working as expected.
Upvotes: 0
Reputation: 81
You simple type . instead of react-app-name
npx create-react-app .
If you have already had any folder name which starts with . then you will get an error. You need to remove the folder and then try above command
Upvotes: 4
Reputation: 31
When you use create-react-app app-name
, the part that comes after create-react-app
tells CRA where to create a react app. So create-react-app app-name
is actually telling CRA to create a react app in a new directory called 'my-app'. This can cause lots of issues with deployment for the inexperienced developer.
By using npx create-react-app .
we can tell CRA to create a react app here or in the current directory. This will help prevent any issues which may come from not having your react app directly in the root directory of your project or repo.
Upvotes: 3
Reputation: 583
if your are using the latest version of Nodejs so you can use this code:
npx create-react-app your-app-name
you check Node version by this code:
node --version
it shall be above v10
Upvotes: -12
Reputation: 3012
The following works only if your current directory complies with npm naming restrictions.
npx create-react-app .
The current directory must:
E.g., current directory cannot be named "React App". It must be "react-app".
Upvotes: 26
Reputation: 2438
If you've previously installed
create-react-app
globally vianpm install -g create-react-app
, we recommend you uninstall the package usingnpm uninstall -g create-react-app
to ensure thatnpx
always uses the latest version.
For a new version of create-react-app
(v3):
npx create-react-app .
Please pay attention to a full stop(dot) at the end of your command .
which corresponds to a current directory
Upvotes: 121
Reputation: 112777
You can create a new React app in the current directory by writing .
instead of a project name.
create-react-app .
Upvotes: 446