发布更改:未找到错误命令“ publish-gh-pages”

时间:2019-08-03 05:03:10

标签: yarnpkg docusaurus

我能够按照指南进行操作,并发布了以下页面: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"
    ]
  }
}

1 个答案:

答案 0 :(得分:1)

Docusaurus维护者在这里!

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

尝试将命令更改为:

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

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