|
| 1 | +--- |
| 2 | +title: 'Development' |
| 3 | +description: 'Preview changes locally to update your docs' |
| 4 | +--- |
| 5 | + |
| 6 | +<Info> |
| 7 | + **Prerequisite**: Please install Node.js (version 19 or higher) before proceeding. |
| 8 | +</Info> |
| 9 | + |
| 10 | +Follow these steps to install and run Mintlify on your operating system: |
| 11 | + |
| 12 | +**Step 1**: Install Mintlify: |
| 13 | + |
| 14 | +<CodeGroup> |
| 15 | + |
| 16 | + ```bash npm |
| 17 | + npm i -g mintlify |
| 18 | + ``` |
| 19 | + |
| 20 | +```bash yarn |
| 21 | +yarn global add mintlify |
| 22 | +``` |
| 23 | + |
| 24 | +</CodeGroup> |
| 25 | + |
| 26 | +**Step 2**: Navigate to the docs directory (where the `mint.json` file is located) and execute the following command: |
| 27 | + |
| 28 | +```bash |
| 29 | +mintlify dev |
| 30 | +``` |
| 31 | + |
| 32 | +A local preview of your documentation will be available at `http://localhost:3000`. |
| 33 | + |
| 34 | +### Custom Ports |
| 35 | + |
| 36 | +By default, Mintlify uses port 3000. You can customize the port Mintlify runs on by using the `--port` flag. To run Mintlify on port 3333, for instance, use this command: |
| 37 | + |
| 38 | +```bash |
| 39 | +mintlify dev --port 3333 |
| 40 | +``` |
| 41 | + |
| 42 | +If you attempt to run Mintlify on a port that's already in use, it will use the next available port: |
| 43 | + |
| 44 | +```md |
| 45 | +Port 3000 is already in use. Trying 3001 instead. |
| 46 | +``` |
| 47 | + |
| 48 | +## Mintlify Versions |
| 49 | + |
| 50 | +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: |
| 51 | + |
| 52 | +<CodeGroup> |
| 53 | + |
| 54 | +```bash npm |
| 55 | +npm i -g mintlify@latest |
| 56 | +``` |
| 57 | + |
| 58 | +```bash yarn |
| 59 | +yarn global upgrade mintlify |
| 60 | +``` |
| 61 | + |
| 62 | +</CodeGroup> |
| 63 | + |
| 64 | +## Validating Links |
| 65 | + |
| 66 | +The CLI can assist with validating reference links made in your documentation. To identify any broken links, use the following command: |
| 67 | + |
| 68 | +```bash |
| 69 | +mintlify broken-links |
| 70 | +``` |
| 71 | + |
| 72 | +## Deployment |
| 73 | + |
| 74 | +<Tip> |
| 75 | + Unlimited editors available under the [Pro |
| 76 | + Plan](https://mintlify.com/pricing) and above. |
| 77 | +</Tip> |
| 78 | + |
| 79 | +If the deployment is successful, you should see the following: |
| 80 | + |
| 81 | +<Frame> |
| 82 | + <img src="/images/checks-passed.png" style={{ borderRadius: '0.5rem' }} /> |
| 83 | +</Frame> |
| 84 | + |
| 85 | +## Code Formatting |
| 86 | + |
| 87 | +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. |
| 88 | + |
| 89 | +## Troubleshooting |
| 90 | + |
| 91 | +<AccordionGroup> |
| 92 | + <Accordion title='Error: Could not load the "sharp" module using the darwin-arm64 runtime'> |
| 93 | + |
| 94 | + This may be due to an outdated version of node. Try the following: |
| 95 | + 1. Remove the currently-installed version of mintlify: `npm remove -g mintlify` |
| 96 | + 2. Upgrade to Node v19 or higher. |
| 97 | + 3. Reinstall mintlify: `npm install -g mintlify` |
| 98 | + </Accordion> |
| 99 | + |
| 100 | + <Accordion title="Issue: Encountering an unknown error"> |
| 101 | + |
| 102 | + Solution: Go to the root of your device and delete the \~/.mintlify folder. Afterwards, run `mintlify dev` again. |
| 103 | + </Accordion> |
| 104 | +</AccordionGroup> |
| 105 | + |
| 106 | +Curious about what changed in the CLI version? [Check out the CLI changelog.](https://www.npmjs.com/package/mintlify?activeTab=versions) |
0 commit comments