Gatsby
Gatsby is a free and open-source framework built on React for creating blazing-fast websites and apps. It supports various data sources like Markdown, headless CMS, and GraphQL APIs, offering Static Site Generation (SSG), Deferred Static Generation (DSG), and Server-Side Rendering (SSR) options. Version 5.16.1 is the current stable release, with frequent patch and minor updates.
Common errors
-
error glob@11.0.3: The engine "node" is incompatible with this module. Expected version "20 || >=22". Got "18.6.0"
cause A transitive dependency `glob` has a strict Node.js version requirement that might conflict with Node.js 18.fixUpgrade Gatsby to 5.14.6 or later, or use Node.js version 20 or 22. -
isNonNullType is not defined
cause Compatibility issue with `webpack` versions equal to or greater than 5.99.0 during schema generation.fixUpgrade Gatsby to 5.14.2 or later to fix this `webpack` compatibility issue.
Warnings
- gotcha When using Node.js 22, it is highly recommended to use the latest 22.x release to avoid known issues with older versions.
- gotcha Gatsby now formally supports React 19. Ensure your project's React dependencies are updated if you intend to use React 19.
- gotcha Users of Gatsby Head API (e.g., for setting document title) might have experienced regressions where `<title>` tags did not update `document.title` correctly.
- breaking The `gatsby-source-shopify` plugin was upgraded to use Shopify API version 2024-04 from 2022-04, which may introduce breaking changes for existing Shopify integrations.
- gotcha Some Node.js 18 users might encounter `npm install` errors related to `glob` engine incompatibility with certain transitive dependencies.
Install
-
npm install gatsby -
yarn add gatsby -
pnpm add gatsby
Imports
- Link
import { Link } from 'gatsby' - Head
import { Head } from 'gatsby'
Quickstart
gatsby new my-gatsby-site cd my-gatsby-site gatsby develop