Skip to content

Pre-commit job failing on Gitlab-CI due to warning on --ignore-prepublish for npm during Markdownlint-cli installation #3516

@ojob

Description

@ojob

search you tried in the issue tracker

markdownlintcli, node, npm, --ignore-prepublish

describe your issue

In our company, we have been happily using markdownlint-cli for years in our Gitlab-CI pipelines, for multiple projects.

But lately, we face the following issue: installation of markdownlint-cli fails with a bizarre sequence:

    Unknown cli config "--ignore-prepublish". This will stop working in the next major version of npm.
    npm error Exit handler never called!

What I observe

pre-commit runs fine on my dev machine, running under Windows.

In Gitlab-CI, I run it on a uv image with Python 3.12:

Running with gitlab-runner 18.1.1 (2b813ade)
  on DefaultRunner t1qSxxxxx, system ID: s_xxxxxxxxxxx
  feature flags: FF_USE_FASTZIP:true
Preparing the "docker" executor 00:03
Using Docker executor with image ghcr.io/astral-sh/uv:0.8-python3.12-bookworm ...
Using effective pull policy of [always] for container ghcr.io/astral-sh/uv:0.8-python3.12-bookworm
Pulling docker image ghcr.io/astral-sh/uv:0.8-python3.12-bookworm ...
Using docker image sha256:566bb53d9b9448cd2177b3ca8e1e92343c29cff2167e5a64da737cf3682b49c8 for ghcr.io/astral-sh/uv:0.8-python3.12-bookworm with digest ghcr.io/astral-sh/uv@sha256:60237b976daf9a93ea105208c13a97777748568587b0b62cb5f3d7fe5486f7c4 ...
Preparing environment 00:01
Using effective pull policy of [always] for container sha256:d23126655d95e25368ef36121cd5be58b1bc011113ef25a7040bfeb1f46b129f
Running on runner-t1xxxxxxxxx-project-3-concurrent-0 via xx.xxxx.xxxx.net...
Getting source from Git repository 00:13
Gitaly correlation ID: 01K3xxxxxxxxxxxxxxxxxxxxxxxx
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in /builds/xxxxxxx/xxxxxx/.git/
Created fresh repository.
Checking out 7632e02b as detached HEAD (ref is refs/merge-requests/922/head)...
Removing .cache/
Removing .mypy_cache/
Removing .ruff_cache/
Removing .venv/
Updating/initializing submodules recursively with git depth set to 20...
Updated submodules
Restoring cache 00:00
Checking cache for xxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx-non_protected...
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted. 
WARNING: Cache file does not exist                 
Failed to extract cache
Checking cache for xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-non_protected...
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted. 
WARNING: Cache file does not exist                 
Failed to extract cache
Executing "step_script" stage of the job script 04:52
Using effective pull policy of [always] for container ghcr.io/astral-sh/uv:0.8-python3.12-bookworm
Using docker image sha256:566bb53d9b9448cd2177b3ca8e1e92343c29cff2167e5a64da737cf3682b49c8 for ghcr.io/astral-sh/uv:0.8-python3.12-bookworm with digest ghcr.io/astral-sh/uv@sha256:60237b976daf9a93ea105208c13a97777748568587b0b62cb5f3d7fe5486f7c4 ...
$ python --version
Python 3.12.11
$ uv sync
Using CPython 3.12.11 interpreter at: /usr/local/bin/python3.12
Creating virtual environment at: .venv
Resolved 70 packages in 9.36s
   Building robotframework-jsonlibrary==0.5
      Built robotframework-jsonlibrary==0.5
Downloading aiohttp (1.6MiB)
Downloading mypy (11.8MiB)
 Downloading aiohttp
Downloading mysql-connector-python (32.3MiB)
Downloading virtualenv (4.1MiB)
 Downloading virtualenv
Downloading selenium (8.9MiB)
 Downloading selenium
 Downloading mysql-connector-python
 Downloading mypy
Prepared 66 packages in 13.93s
Installed 66 packages in 7.79s
 + aiofiles==24.1.0
 + aiohappyeyeballs==2.6.1
 + aiohttp==3.11.11
 + aiosignal==1.3.2
 + attrs==25.3.0
 + certifi==2025.1.31
 + cfgv==3.4.0
 + charset-normalizer==3.4.1
 + click==8.1.8
 + colorlog==6.9.0
 + defusedxml==0.7.1
 + distlib==0.3.9
 + filelock==3.18.0
 + frozenlist==1.6.0
 + h11==0.16.0
 + icdiff==2.0.7
 + identify==2.6.10
 + idna==3.10
 + iniconfig==2.1.0
 + jsonpath-ng==1.7.0
 + jsonschema==4.23.0
 + jsonschema-specifications==2025.4.1
 + multidict==6.4.3
 + mypy==1.15.0
 + mypy-extensions==1.1.0
 + mysql-connector-python==9.3.0
 + nodeenv==1.9.1
 + outcome==1.3.0.post0
 + packaging==25.0
 + pip-system-certs==4.0
 + platformdirs==4.3.7
 + pluggy==1.5.0
 + ply==3.11
 + pprintpp==0.4.0
 + pre-commit==4.3.0
 + propcache==0.3.1
 + pymysql==1.1.1
 + pysocks==1.7.1
 + pytest==8.3.5
 + pytest-icdiff==0.9
 + pytest-mypy==1.0.1
 + pyyaml==6.0.2
 + referencing==0.36.2
 + requests==2.32.3
 + robotframework==7.2.2
 + robotframework-assertion-engine==3.0.3
 + robotframework-databaselibrary==2.1.3
 + robotframework-jsonlibrary==0.5
 + robotframework-pythonlibcore==4.4.1
 + robotframework-requests==0.9.7
 + rpds-py==0.24.0
 + selenium==4.31.0
 + snaplogic-cli==0.4.40
 + sniffio==1.3.1
 + sortedcontainers==2.4.0
 + trio==0.30.0
 + trio-websocket==0.12.2
 + types-pyyaml==6.0.12.20250402
 + types-requests==2.32.0.20250328
 + typing-extensions==4.13.2
 + urllib3==2.4.0
 + virtualenv==20.30.0
 + websocket-client==1.8.0
 + wrapt==1.17.2
 + wsproto==1.2.0
 + yarl==1.20.0
$ uv run pre-commit run --all-files
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/gitleaks/gitleaks.
[INFO] Initializing environment for https://github.com/igorshubovych/markdownlint-cli.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-mypy.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-mypy:types-PyYAML,types-requests.
[INFO] Initializing environment for https://github.com/astral-sh/ruff-pre-commit.
[INFO] Initializing environment for https://github.com/alessandrojcm/commitlint-pre-commit-hook.
[INFO] Initializing environment for https://github.com/alessandrojcm/commitlint-pre-commit-hook:@commitlint/config-conventional.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/gitleaks/gitleaks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/igorshubovych/markdownlint-cli.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/builds/xxxxx/xxxxxxxxxxx/.cache/pre-commit/repoxxxxxxx/node_env-default/bin/node', '/builds/xxxxxxxx/xxxxxxxxx/.cache/pre-commit/repoxxxxxxxx/node_env-default/bin/npm', 'install', '--include=dev', '--include=prod', '--ignore-prepublish', '--no-progress', '--no-save')
return code: 1
stdout: (none)
stderr:
    npm warn Unknown cli config "--ignore-prepublish". This will stop working in the next major version of npm.
    npm error Exit handler never called!
    npm error This is an error with npm itself. Please report this error at:
    npm error   <https://github.com/npm/cli/issues>
    npm error A complete log of this run can be found in: /root/.npm/_logs/2025-08-19T12_24_11_791Z-debug-0.log
Check the log at /builds/xxxxxx/xxxxxxx/.cache/pre-commit/pre-commit.log

Sadly, I have no access to the log files in question.

What I’ve tried

  • downgrading uv to 0.5, in an attempt to pull an older npm version: not better
  • upgrading to pre-commit 4.3.0 : not better
  • remove markdownlintcli from hooks: pre-commit installation completes, but obviously with Markdown linting capacity not available, so that’s just a workaround
  • update markdownlintcli to 0.45.0: not better

So what?

  • The command to run npm install seems deprecated, but already raises an error at npm level. Could this be circumvented?
  • Could this be related to the underlying

pre-commit --version

pre-commit 4.2.0, 4.3.0

.pre-commit-config.yaml

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v5.0.0
    hooks:
      # exclude Power Apps and Power BI source folders, as full of nasty things.
      - id: check-added-large-files
      - id: check-case-conflict
      - id: check-json
      - id: check-merge-conflict
      - id: check-toml
      - id: check-yaml
        exclude: ^code/.+/(power_app|power_bi)/
      - id: end-of-file-fixer
        exclude: ^code/.+/(power_app|power_bi)/
      - id: mixed-line-ending
        exclude: ^code/.+/(power_app|power_bi)/
      - id: no-commit-to-branch
        args: [--branch, master, --branch, develop]
      - id: trailing-whitespace
        exclude: ^code/.+/(power_app|power_bi)/
  - repo: https://github.com/gitleaks/gitleaks
    rev: v8.24.3
    hooks:
      - id: gitleaks
  # Requires deactivation of Kaizen certificates manipulation, so that
  # https://registry.npmjs.org/ can be accessed without manipulation of node
  # local installation.
  - repo: https://github.com/igorshubovych/markdownlint-cli
    rev: v0.44.0
    hooks:
      - id: markdownlint
  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v1.15.0
    hooks:
      - id: mypy
        additional_dependencies: [types-PyYAML, types-requests]
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.11.7
    hooks:
      - id: ruff
        args: [--fix, --exit-non-zero-on-fix]
      - id: ruff-format
  # See Configuration: this is triggered using a specific hook, so shall
  # be installed using following command:
  #     pre-commit install --hook-type commit-msg
  - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
    rev: v9.22.0
    hooks:
      - id: commitlint
        stages: [commit-msg]
        additional_dependencies: ['@commitlint/config-conventional']

~/.cache/pre-commit/pre-commit.log (if present)

[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/gitleaks/gitleaks.
[INFO] Initializing environment for https://github.com/igorshubovych/markdownlint-cli.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-mypy.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-mypy:types-PyYAML,types-requests.
[INFO] Initializing environment for https://github.com/astral-sh/ruff-pre-commit.
[INFO] Initializing environment for https://github.com/alessandrojcm/commitlint-pre-commit-hook.
[INFO] Initializing environment for https://github.com/alessandrojcm/commitlint-pre-commit-hook:@commitlint/config-conventional.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/gitleaks/gitleaks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/igorshubovych/markdownlint-cli.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/builds/xxxxx/xxxxx/.cache/pre-commit/repoxxxxxxx/node_env-default/bin/node', '/builds/xxxxx/xxxxxx/.cache/pre-commit/repoxxxxxx/node_env-default/bin/npm', 'install', '--include=dev', '--include=prod', '--ignore-prepublish', '--no-progress', '--no-save')
return code: 1
stdout: (none)
stderr:
npm warn Unknown cli config "--ignore-prepublish". This will stop working in the next major version of npm.
npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /root/.npm/_logs/2025-08-19T12_24_11_791Z-debug-0.log
Check the log at /builds/xxxxx/xxxxxx/.cache/pre-commit/pre-commit.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions