第一步

yarn add -D vuepress
yarn add vuepress-cli

安装cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org

安装 pnpm

npm i pnpm -g

升级 pnpm

pnpm add -g pnpm to update 

安装 vuepress

cnpm install -D vuepress
cnpm install -D vuepress-cli

切换淘宝源

pnpm config set registry https://registry.npmmirror.com

安装项目依赖

pnpm install

安装日志

yarn add v1.22.19                                                                                                       warning 
package.json: License should be a valid SPDX license expression                                                 warning package-
lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in 
order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.                                                                                      
warning jetlinks-docs: License should be a valid SPDX license expression                                                [1/4] 
Resolving packages...                                                                                             warning vuepress 
> @vuepress/types > @types/markdown-it > highlight.js@9.18.5: Support has ended for 9.x series. Upgrade to @latest                                                                                                             
> [2/4] Fetching packages...                                                                                              warning 
url-loader@1.1.2: Invalid bin field for "url-loader".                                                           [3/4] Linking 
dependencies...                                                                                           [4/4] Building fresh 
packages...                                                                                        success Saved lockfile.                                                                                                 
warning jetlinks-docs: License should be a valid SPDX license expression                                                success 
Saved 36 new dependencies.                                                                                      info Direct 
dependencies                                                                                                ├─ vuepress-plugin-
medium-zoom@1.1.9                                                                                    └─ vuepress@1.9.7                                                                                                       
info All dependencies                                                                                                   ├─ 
@types/body-parser@1.19.2                                                                                            ├─ 
@types/connect-history-api-fallback@1.3.5                                                                            ├─ 
@types/connect@3.4.35                                                                                                ├─ 
@types/express-serve-static-core@4.17.29                                                                             ├─ 
@types/express@4.17.13                                                                                               ├─ 
@types/highlight.js@9.12.4                                                                                           ├─ 
@types/http-proxy@1.17.9                                                                                             ├─ 
@types/linkify-it@3.0.2                                                                                              ├─ 
@types/markdown-it@10.0.3                                                                                            ├─ 
@types/mdurl@1.0.2                                                                                                   ├─ 
@types/mime@1.3.2                                                                                                    ├─ 
@types/range-parser@1.2.4                                                                                            ├─ 
@types/source-list-map@0.1.2                                                                                         ├─ 
@types/tapable@1.0.8                                                                                                 ├─ 
@types/uglify-js@3.16.0                                                                                              ├─ 
@types/webpack-dev-server@3.11.6                                                                                     ├─ 
@types/webpack-sources@3.2.0                                                                                         ├─ 
@types/webpack@4.41.32                                                                                               ├─ 
@vuepress/core@1.9.7                                                                                                 ├─ 
@vuepress/markdown-loader@1.9.7                                                                                      ├─ 
@vuepress/plugin-active-header-links@1.9.7                                                                           ├─ 
@vuepress/plugin-last-updated@1.9.7                                                                                  ├─ 
@vuepress/plugin-nprogress@1.9.7                                                                                     ├─ 
@vuepress/plugin-register-components@1.9.7                                                                           ├─ 
@vuepress/plugin-search@1.9.7                                                                                        ├─ 
@vuepress/theme-default@1.9.7                                                                                        ├─ bundle-
require@2.1.8                                                                                                 ├─ esbuild-windows-
64@0.14.7                                                                                            ├─ esbuild@0.14.7                                                                                                       
├─ highlight.js@9.18.5                                                                                                  ├─ is-
plain-obj@3.0.0                                                                                                   ├─ node-
forge@0.9.0                                                                                                     ├─ stylus@0.54.8                                                                                                        
├─ vue-router@3.5.4                                                                                                     ├─ 
vuepress-plugin-medium-zoom@1.1.9                                                                                    └─ 
vuepress@1.9.7 

验证

{
  "name": "xxx",
  "license": "apache 2.0",
  "scripts": {
    "docs:dev": "vuepress dev .",
    "docs:build": "vuepress build .",
    "build": "node --max_old_space_size=10240 build/build.js"
  },
  "devDependencies": {
    "vuepress": "^1.9.7",
    "vuepress-plugin-medium-zoom": "^1.1.8"
  }
}

启动

> docs:dev
> vuepress dev .

wait Extracting site metadata... 
tip Apply theme @vuepress/theme-default ... 
tip Apply plugin container (i.e. "vuepress-plugin-container") ... 
success [10:05:15] Build b100a3 finished in 16599 ms!     
> VuePress dev server listening at http://localhost:9999/ 

可以看到

  • VuePress dev server listening at http://localhost:9999/
Logo

前往低代码交流专区

更多推荐