Skip to content

Latest commit

 

History

History
120 lines (80 loc) · 3.15 KB

File metadata and controls

120 lines (80 loc) · 3.15 KB
layout docs
order 2
tocHeading 2

Setup

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.

Init

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@latest

To scaffold into a custom directory, run:

# initialize a new directory called my-app for your Greenwood project
$ npx @greenwood/init@latest my-app

Install

You can install the Greenwood CLI manually through your preferred package manager:

npm i -D @greenwood/cli@latest
yarn add @greenwood/cli@latest --save-dev
pnpm add -D @greenwood/cli@latest

Commands

The 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"
  }
}

Troubleshooting

Rollup Linux x64 GNU

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"
  }
}