> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ecge.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Local development

> Run ecge locally and preview changes in real time

<Info>
  **Prerequisites**:

  * Node.js version 19 or higher
  * A project directory with an `ecge.config.json` file
</Info>

Follow these steps to set up your local development environment.

<Steps>
  <Step title="Install the ecge CLI">
    ```bash theme={null}
    npm i -g ecge
    ```
  </Step>

  <Step title="Start the dev server">
    Navigate to your project directory and run:

    ```bash theme={null}
    ecge dev
    ```

    A local preview will be available at `http://localhost:3000`.
  </Step>
</Steps>

## Custom ports

By default, ecge uses port 3000. You can customize this with the `--port` flag:

```bash theme={null}
ecge dev --port 3333
```

If the port is already in use, ecge will automatically try the next available port:

```md theme={null}
Port 3000 is already in use. Trying 3001 instead.
```

## CLI versions

Each CLI release is tied to a specific platform version. If your local preview doesn't match production, update the CLI:

```bash theme={null}
npm update -g ecge
```

## Validating links

The CLI can validate internal links across your project:

```bash theme={null}
ecge check-links
```

## Deployment

When deployment succeeds, you'll see a confirmation:

<Frame>
  <img src="https://mintcdn.com/ecge/vu3tOx1cKnZBbg96/images/checks-passed.png?fit=max&auto=format&n=vu3tOx1cKnZBbg96&q=85&s=f5668582a9d7bdf6f06da9b1d41bea83" alt="Deployment confirmation showing all checks have passed." style={{ borderRadius: '0.5rem' }} width="1100" height="346" data-path="images/checks-passed.png" />
</Frame>

## Editor setup

We recommend using an editor with MDX support. For VS Code, install the [MDX extension](https://marketplace.visualstudio.com/items?itemName=unifiedjs.vscode-mdx) for syntax highlighting and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) for formatting.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Error: Could not load the &#x22;sharp&#x22; module">
    This is usually caused by an outdated Node.js version:

    1. Remove the current CLI: `npm remove -g ecge`
    2. Upgrade to Node v19 or higher.
    3. Reinstall: `npm i -g ecge`
  </Accordion>

  <Accordion title="Unknown error on startup">
    Delete the cache directory and restart:

    ```bash theme={null}
    rm -rf ~/.ecge && ecge dev
    ```
  </Accordion>
</AccordionGroup>
