development.mdx 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. ---
  2. title: 'Development'
  3. description: 'Preview changes locally to update your docs'
  4. ---
  5. <Info>
  6. **Prerequisites**:
  7. - Node.js version 19 or higher
  8. - A docs repository with a `docs.json` file
  9. </Info>
  10. Follow these steps to install and run Mintlify on your operating system.
  11. <Steps>
  12. <Step title="Install the Mintlify CLI">
  13. ```bash
  14. npm i -g mint
  15. ```
  16. </Step>
  17. <Step title="Preview locally">
  18. Navigate to your docs directory where your `docs.json` file is located, and run the following command:
  19. ```bash
  20. mint dev
  21. ```
  22. A local preview of your documentation will be available at `http://localhost:3000`.
  23. </Step>
  24. </Steps>
  25. ## Custom ports
  26. By default, Mintlify uses port 3000. You can customize the port Mintlify runs on by using the `--port` flag. For example, to run Mintlify on port 3333, use this command:
  27. ```bash
  28. mint dev --port 3333
  29. ```
  30. If you attempt to run Mintlify on a port that's already in use, it will use the next available port:
  31. ```md
  32. Port 3000 is already in use. Trying 3001 instead.
  33. ```
  34. ## Mintlify versions
  35. Please note that each CLI release is associated with a specific version of Mintlify. If your local preview does not align with the production version, please update the CLI:
  36. ```bash
  37. npm mint update
  38. ```
  39. ## Validating links
  40. The CLI can assist with validating links in your documentation. To identify any broken links, use the following command:
  41. ```bash
  42. mint broken-links
  43. ```
  44. ## Deployment
  45. If the deployment is successful, you should see the following:
  46. <Frame>
  47. <img src="/images/checks-passed.png" alt="Screenshot of a deployment confirmation message that says All checks have passed." style={{ borderRadius: '0.5rem' }} />
  48. </Frame>
  49. ## Code formatting
  50. 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.
  51. ## Troubleshooting
  52. <AccordionGroup>
  53. <Accordion title='Error: Could not load the "sharp" module using the darwin-arm64 runtime'>
  54. This may be due to an outdated version of node. Try the following:
  55. 1. Remove the currently-installed version of the CLI: `npm remove -g mint`
  56. 2. Upgrade to Node v19 or higher.
  57. 3. Reinstall the CLI: `npm i -g mint`
  58. </Accordion>
  59. <Accordion title="Issue: Encountering an unknown error">
  60. Solution: Go to the root of your device and delete the `~/.mintlify` folder. Then run `mint dev` again.
  61. </Accordion>
  62. </AccordionGroup>
  63. Curious about what changed in the latest CLI version? Check out the [CLI changelog](https://www.npmjs.com/package/mintlify?activeTab=versions).