Skip to content

Docusaurus

安装

官方提供了较为详细的文档,可参考此链接 安装 | Docusaurus中文文档. 本文安装以windows系统为例.

系统需求

Node.js 16.14 或更高版本(可以通过执行 node -v 命令来查看当前所用的 Node。js 版本)。你可以使用 nvm 管理同一台计算机上安装的多个 Node 版本。 当安装 Node.js 时,建议选中与依赖项相关的所有复选框。

搭建

my-website 替换为自己网站的名称

bash
E:\github\docusaurus> npx create-docusaurus@latest my-website classic
Need to install the following packages:
create-docusaurus@2.4.1
Ok to proceed? (y)
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
[INFO] Creating new Docusaurus project...
[INFO] Installing dependencies with npm...
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'cosmiconfig@8.3.2',
npm WARN EBADENGINE   required: { node: '>=18' },
npm WARN EBADENGINE   current: { node: 'v16.18.1', npm: '9.8.1' }
npm WARN EBADENGINE }
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated @babel/plugin-proposal-object-rest-spread@7.12.1: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead.
npm WARN deprecated trim@0.0.1: Use String.prototype.trim() instead

added 1117 packages in 3m
[SUCCESS] Created my-website.
[INFO] Inside that directory, you can run several commands:

  `npm start`
    Starts the development server.

  `npm run build`
    Bundles your website into static files for production.

  `npm run serve`
    Serves the built website locally.

  `npm deploy`
    Publishes the website to GitHub pages.

We recommend that you begin by typing:

  `cd my-website`
  `npm start`

Happy building awesome websites!

npm notice
npm notice New major version of npm available! 9.8.1 -> 10.0.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.0.0
npm notice Run npm install -g npm@10.0.0 to update!
npm notice
PS E:\github\docusaurus>