Skip to content

npx docusaurus --version incorrect program termination status #10367

Closed
@IgorKha

Description

@IgorKha

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executionstatus: needs triageThis issue has not been triaged by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions