DEV Community

Cover image for How to Deploy JavaScript/React Apps to Netlify through CLI(Part 2)
Kritika Srivastava
Kritika Srivastava

Posted on

How to Deploy JavaScript/React Apps to Netlify through CLI(Part 2)

Hello Dev Friends.This is the Part 2 of How to deploy React Apps to Netlify as here I am going to explain you how to deploy your App to Netlify through CLI.

So let us get started by opening the VS Code.
Follow the below steps once your project is ready to deploy.

1.Make sure you are in your current project's folder.Install netlify globally if you are doing it for the first time.

npm install -g netlify-cli
Enter fullscreen mode Exit fullscreen mode

2.Now run the below command in terminal,

netlify init
Enter fullscreen mode Exit fullscreen mode

Alt Text

It will ask you to login to Netlify and to authorise for the first time in your browser.

Now press enter in terminal and give other details and site name which is optional.

Here you can choose "Yes,create deploy site for manually." if you want to do without github or you can choose github option.
Once the deployment is done,we will get the below screen.

Alt Text

3.Now run the below command for deployment,

 netlify deploy
Enter fullscreen mode Exit fullscreen mode

Alt Text

Now you can select current path by pressing enter or you may give your own path.(as shown above)
Alt Text

4.Now finally execute the below command,

netlify deploy --prod
Enter fullscreen mode Exit fullscreen mode

and choose current path.

Alt Text
Once the process is completed, you can open the generated link and see your project live.(as shown above)

For example,
This is our project which I have used just for explaining this process.

Alt Text
Demo Link

Let me know what you create.
Happy Learning :)

You can follow me on Twitter and Github.

Top comments (1)

Collapse
 
aalphaindia profile image
Pawan Pawar

Good one!!