development.mdx 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. ---
  2. title: "Development"
  3. description: "Preview changes locally to update your docs"
  4. ---
  5. <Info>**Prerequisites**: - Node.js version 19 or higher - A docs repository with a `docs.json` file</Info>
  6. Follow these steps to install and run Mintlify on your operating system.
  7. <Steps>
  8. <Step title="Install the Mintlify CLI">
  9. ```bash
  10. npm i -g mint
  11. ```
  12. </Step>
  13. <Step title="Preview locally">
  14. Navigate to your docs directory where your `docs.json` file is located, and run the following command:
  15. ```bash
  16. mint dev
  17. ```
  18. A local preview of your documentation will be available at `http://localhost:3000`.
  19. </Step>
  20. </Steps>
  21. ## Custom ports
  22. 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:
  23. ```bash
  24. mint dev --port 3333
  25. ```
  26. If you attempt to run Mintlify on a port that's already in use, it will use the next available port:
  27. ```md
  28. Port 3000 is already in use. Trying 3001 instead.
  29. ```
  30. ## Mintlify versions
  31. 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:
  32. ```bash
  33. npm mint update
  34. ```
  35. ## Validating links
  36. The CLI can assist with validating links in your documentation. To identify any broken links, use the following command:
  37. ```bash
  38. mint broken-links
  39. ```
  40. ## Deployment
  41. If the deployment is successful, you should see the following:
  42. <Frame>
  43. <img
  44. src="/images/checks-passed.png"
  45. alt="Screenshot of a deployment confirmation message that says All checks have passed."
  46. style={{ borderRadius: "0.5rem" }}
  47. />
  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).