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

# Local Development

> Preview changes locally to update your docs

<Info>
  **Prerequisite**: Please install Node.js (version 19 or higher) before proceeding.
</Info>

**Step 1**: Install the Mintlify CLI:

<CodeGroup>
  ```bash npm theme={null}
  npm i -g mintlify
  ```

  ```bash yarn theme={null}
  yarn global add mintlify
  ```

  ```bash pnpm theme={null}
  pnpm add -g mintlify
  ```
</CodeGroup>

**Step 2**: Navigate to the docs directory (where the `docs.json` file is located) and execute the following command:

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

Alternatively, if you do not want to install the CLI globally you can use a run script available:

<CodeGroup>
  ```bash npm theme={null}
  npx mintlify dev
  ```

  ```bash yarn theme={null}
  yarn dlx mintlify dev
  ```

  ```bash pnpm theme={null}
  pnpm dlx mintlify dev
  ```
</CodeGroup>

<Warning>
  Yarn's "dlx" run script requires yarn version >2. See [here](https://yarnpkg.com/cli/dlx) for more information.
</Warning>

A local preview of your documentation will be available at `http://localhost:3000`.

### Custom Ports

By default, Mintlify uses port 3000. You can customize the port using the `--port` flag. To run Mintlify on port 3333, for instance, use this command:

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

If you attempt to run on a port that's already in use, it will use the next available port:

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

## Versions

Please note that each CLI release is associated with a specific version of Mintlify. If your local website doesn't align with the production version, please update the CLI:

<CodeGroup>
  ```bash npm theme={null}
  npm i -g mintlify@latest
  ```

  ```bash yarn theme={null}
  yarn global upgrade mintlify
  ```

  ```bash pnpm theme={null}
  pnpm up --global mintlify
  ```
</CodeGroup>

## Validating Links

The CLI can assist with validating reference links made in your documentation. To identify any broken links, use the following command:

```bash theme={null}
mintlify broken-links
```

## Deployment

If the deployment is successful, you should see the following:

<Frame>
  <img className="rounded-md" src="https://mintlify.s3-us-west-1.amazonaws.com/mintlify/images/checks-passed.png" />
</Frame>

## Code Formatting

We suggest using extensions on your IDE to recognize and format MDX. If you're a VSCode user, consider the [MDX VSCode 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 code formatting.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Error: Could not load the &#x22;sharp&#x22; module using the darwin-arm64 runtime">
    This may be due to an outdated version of node. Try the following:

    1. Remove the currently-installed version of mintlify: `npm remove -g mintlify`
    2. Upgrade to Node v19 or higher.
    3. Reinstall mintlify: `npm install -g mintlify`
  </Accordion>

  <Accordion title="Issue: Encountering an unknown error">
    Solution: Go to the root of your device and delete the \~/.mintlify folder. Afterwards, run `mintlify dev` again.
  </Accordion>
</AccordionGroup>
