Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how do you clone a git Gatsby project and run it locally?

I’m familiar with cloning git projects.
But I’m struggling to clone a Gatsby project, https://github.com/MunifTanjim/gatsby-theme-dox, and then run the website locally.

I run git clone https://github.com/MunifTanjim/gatsby-theme-dox

Then it downloads

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I go into the correct directly, and I’ve tried
gatsby build

This works
then
gatsby develop

I get the following error:

ERROR gatsby <develop> can only be run for a gatsby site.
Either the current working directory does not contain a valid package.json or 'gatsby' is 
not specified as a dependency

I’ve also tried
I also cd into the demo folder and run the same — I get it to run locally but with a 404 error…

Is it possible to run the demo of this gatsby project?

I’m quite new to Gatsby so trying to understand by starting with a prebuilt project.

>Solution :

Once you clone the repository you need to install the dependencies. cd to the root of your project and run npm install or yarn install.

gatsby build and gatsby develop, like all Gatsby commands, must be run in the root of your project, where the package.json is located. Otherwise, it will throw an exception.

In your case, run the following in order:

git clone https://github.com/MunifTanjim/gatsby-theme-dox
cd gatsby-theme-dox
npm install #or yarn install
gatsby develop #to build the site in development mode
gatsby build && gatsby serve #to build the site in production mode

I’d suggest taking a look at Gatsby commands (gatsby-cli) to understand what you are running.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading