Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npx docusaurus --version incorrect program termination status #10367

Closed
6 of 7 tasks
IgorKha opened this issue Aug 3, 2024 · 2 comments · Fixed by #10368
Closed
6 of 7 tasks

npx docusaurus --version incorrect program termination status #10367

IgorKha opened this issue Aug 3, 2024 · 2 comments · Fixed by #10368
Labels
bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers

Comments

@IgorKha
Copy link

IgorKha commented Aug 3, 2024

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

After migrating from version 2 to 3, I ran into a problem in the github runner when deploying to github pages.

...
jobs:
  deploy:
    name: Deploy to GitHub Pages
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v3
        with:
          node-version: 20.9.0
          cache: npm
      - name: npm install
        run: npm ci && npx docusaurus --version
      - name: Build website
        run: npm run build

As I managed to find out the problem lies in the fact that after the npx docusaurus --version command is executed the programme terminates with the status (exit 1), but if you use npx docusaurus -V then everything works correctly.

Screenshot 2024-08-03 at 18 11 42
bash-5.2$ npx docusaurus --version
Usage:  <command> [options]

Options:
  -V, --version                                            output the version number
  -h, --help                                               display help for command

Commands:
  build [options] [siteDir]                                Build website.
  swizzle [options] [themeName] [componentName] [siteDir]  Wraps or ejects the original theme files into website folder for customization.
  deploy [options] [siteDir]                               Deploy website to GitHub pages.
  start [options] [siteDir]                                Start the development server.
  serve [options] [siteDir]                                Serve website locally.
  clear [siteDir]                                          Remove build artifacts.
  write-translations [options] [siteDir]                   Extract required translations of your site.
  write-heading-ids [options] [siteDir] [files...]         Generate heading ids in Markdown content.
bash-5.2$ echo $?
1
bash-5.2$ npx docusaurus -V
3.4.0
bash-5.2$ echo $?
0
bash-5.2$ 

Reproducible demo

No response

Steps to reproduce

  1. Use .github/workflows
  2. config
---
name: Deploy to GitHub Pages

on:
  push:
    branches:
      - main
    # Review gh actions docs if you want to further define triggers, paths, etc
    # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on

permissions:
  contents: write

jobs:
  deploy:
    name: Deploy to GitHub Pages
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v3
        with:
          node-version: 20.9.0
          cache: npm
      - name: npm install
        run: npm ci && npx docusaurus --version
      - name: Build website
        run: npm run build
      - name: Copy CNAME
        run: cp CNAME ./build/

Expected behavior

The expectation was that we would not have to redo gh flow and npx docusaurus --version would complete correctly as well as npx docusaurus -V

Actual behavior

npx docusaurus --version terminates differently than npx docusaurus -V.

Your environment

  • Public source code: -
  • Public site URL: -
  • Docusaurus version used: 3.4.0
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): node 20.9.0
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): macOS 14.5 (23F79)

Self-service

  • I'd be willing to fix this bug myself.
@IgorKha IgorKha added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Aug 3, 2024
@ashiq-firoz
Copy link
Contributor

I have checked the repo. Love to work on this issue. Could you assign me this.

@slorber
Copy link
Collaborator

slorber commented Aug 8, 2024

Thanks for reporting, this will be fixed in #10368

By the way, we'll also print the version instead of the help because this is what the command should have done in the first place. Currently it doesn't even print the version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants