How to start a Gatsby project

How to start a Gatsby project

In order to start a Gatsby project, we need to install Gatsby’s CLI tool. Gatsby’s CLI is responsible for getting our Gatsby project up and running, including setting up a development server. In order for us to use the CLI tool, we need to install it via npm.


npm install -g gatsby-cli
        


Once installed, we have a couple options for starting a project. The first is to type the gatsby new command and press enter. From here you will be asked a multitude of questions ranging from the name of the directory that will hold your project to what CMS or content management you will be using such as WordPress. The second option, which we will be using, requires a starter project from Gatsby’s Starter Library.?


No alt text provided for this image


If we scroll down Gatsby’s starter site, and type Hello world, we should see two starter projects. A regular Javascript project and a Typescript project. Lets select the first for our purposes. To run this project, copy and paste the necessary npx command.

No alt text provided for this image



npx gatsby new gatsby-starter-hello-world https://github.com/gatsbyjs/gatsby-starter-hello-world
        


Once this command is executed, cd to your new project with your favorite editor and run npm start.You should now see hello world in your home page at localhost:8000!


No alt text provided for this image




要查看或添加评论,请登录

DeVontae Moore的更多文章

社区洞察

其他会员也浏览了