2

我能够按照指南发布此页面:https ://chengtie.github.io/docusaurus/docs/doc3/

现在,我想做一些小的改变。在我的本地文件夹中更改代码后。我做了:

GIT_USER=chengtie \
  CURRENT_BRANCH=master \
  USE_SSH=true \
  yarn run publish-gh-pages

然后,我得到一个错误:

yarn run v1.16.0
error Command "publish-gh-pages" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

有谁知道如何解决这个问题?

编辑1:

Ties-MBP:my-website chengtie$ GIT_USER=chengtie   CURRENT_BRANCH=master   USE_SSH=true   yarn run deploy
yarn run v1.16.0
$ docusaurus deploy
Deploy command invoked ...
fatal: not a git repository (or any of the parent directories): .git
Creating an optimized production build...

Success! Generated static files in build.

Cloning into 'docusaurus-gh-pages'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Error: Error: git clone failed
    at build_1.build.then (/Users/chengtie/Downloads/my-website/node_modules/@docusaurus/core/lib/commands/deploy.js:84:23)
    at processTicksAndRejections (internal/process/next_tick.js:81:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

这里是package.json

{
  "name": "my-website",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "docusaurus": "docusaurus",
    "start": "docusaurus start",
    "build": "docusaurus build",
    "swizzle": "docusaurus swizzle",
    "deploy": "docusaurus deploy"
  },
  "dependencies": {
    "@docusaurus/core": "^2.0.0-alpha.24",
    "@docusaurus/preset-classic": "^2.0.0-alpha.24",
    "classnames": "^2.2.6",
    "react": "^16.8.4",
    "react-dom": "^16.8.4"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
4

1 回答 1

1

Docusaurus 维护者在这里!

yarn publish-gh-pages是 V1 命令。在 V2 中应该是yarn deploy. 我看到您的链接网站是 V2 网站。请参阅此处的部署文档。

尝试将您的命令更改为:

GIT_USER=chengtie \
  CURRENT_BRANCH=master \
  USE_SSH=true \
  yarn run deploy

还要检查你的package.json并查看有哪些可用的 npm 脚本。

于 2019-08-03T05:59:43.160 回答