| layout | docs |
|---|---|
| order | 2 |
| tocHeading | 2 |
Greenwood has a few options for getting a new project started. You can also check out our Getting Started guide for a full walk-through of creating a simple blog site with Greenwood.
Greenwood supports NodeJS LTS version >= 22.18.0.
The recommended way to start a new Greenwood project, our init CLI will scaffold out a starter project for you. Just run a single command and then follow the prompts. Make sure you have the latest LTS version of Node installed.
To scaffold into the current directory, run:
npx @greenwood/init@latestTo scaffold into a custom directory, run:
# initialize a new directory called my-app for your Greenwood project
$ npx @greenwood/init@latest my-appYou can install the Greenwood CLI manually through your preferred package manager:
npm i -D @greenwood/cli@latestyarn add @greenwood/cli@latest --save-devpnpm add -D @greenwood/cli@latestThe CLI supports three commands, that can be easily mapped to npm scripts in your package.json. You'll also want to make sure you've set the type field to module:
- develop - Start Greenwood's local development server
- build - Build a Greenwood project for production
- serve - Start a production server for self-hosting a Greenwood build
{
"type": "module",
"scripts": {
"dev": "greenwood develop",
"build": "greenwood build",
"serve": "greenwood serve"
}
}If using npm, depending on the version, if you see an error like this in GitHub Actions or any hosting provider:
Error: Cannot find module @rollup/rollup-linux-x64-gnu. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.Add @rollup/rollup-linux-x64-gnu as an optional dependency to your package.json:
{
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "^4.50.0"
}
}