Deploy a Gatsby Site with Netlify

Share this video with your friends

Send Tweet

There are several options for hosting your Gatsby blog. In this lesson, you'll learn how to deploy your site to Netlify.

Alexander Zubko
Alexander Zubko
~ 6 years ago

It's possible to keep the code on GitHub and gatsby build from Netlify, which I think is a better choice for a personal blog.

David Dean
David Dean
~ 5 years ago

This is a great course and I will definitely continue to use Gatsby. In the hopes of helping anyone else who ran into the same problem I did, I would also like to share a comment on the last video for deploying to Netlify. I needed to run gatsby clean first then gatsby build as it was still deploying the develop version which does not work as a standalone app.

Mortimer Jarasemy
Mortimer Jarasemy
~ 5 years ago

I tried installing last episode and running it to see what it builds and turns out it gives me an error saying we are using hooks outside of funcitonal component and doesnt allows me to see it

Mortimer Jarasemy
Mortimer Jarasemy
~ 5 years ago

I am getting an error that says hooks shouldnt be used outside of functional components

Lenmor Larroza Dimanalata
Lenmor Larroza Dimanalata
~ 5 years ago

@Mortimer, I got the same error before. Doing an rm -rf node_modules/ && rm package-lock.json then npm install helped for me

Lauro Silva
Lauro Silva
~ 5 years ago

Yes. It's also possible to deploy the entire Gatsby website to Netlify. Click on the Deploy site button and Netlify will start the build and deploy process you have specified. You can go to the Deploys tab and see the process unfold in the Deploy log. After a few moments, it will give you the live site URL, e.g., random-name.netlify.com.

Remember to add your deploy settings with the below options:

  • Branch to deploy: the default is master.
  • Build Command: the default is npm run build.
  • Publish directory: the default is public.