DavidAnson / markdownlint-cli2

A fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the markdownlint library
MIT License
378 stars 48 forks source link

markdownlint-cli2 not installable in 'pre-commit' framework #443

Closed swaldhoer closed 1 month ago

swaldhoer commented 1 month ago

Tested environments:

Reproducer:

Installation fails with:

pre-commit.exe run
[INFO] Initializing environment for https://github.com/DavidAnson/markdownlint-cli2.
[INFO] Installing environment for https://github.com/DavidAnson/markdownlint-cli2.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('C:\\Users\\stefa\\.cache\\pre-commit\\repop0rj34sg\\node_env-default\\Scripts\\npm.CMD', 'pack')
return code: 4294963238
stdout: (none)
stderr:
    (node:5672) ExperimentalWarning: Support for loading ES Module in require() is an experimental feature and might change at any time
    (Use `node --trace-warnings ...` to show where the warning was created)
    npm warn tarball tarball data for file:C:\Users\stefa\.cache\pre-commit\repop0rj34sg\ (null) seems to be corrupted. Trying again.
    npm warn tarball tarball data for file:C:\Users\stefa\.cache\pre-commit\repop0rj34sg\ (null) seems to be corrupted. Trying again.
    npm error code ENOENT
    npm error syscall lstat
    npm error path C:\Users\stefa\.cache\pre-commit\repop0rj34sg\arsers\jsonc-parse.js
    npm error errno -4058
    npm error enoent ENOENT: no such file or directory, lstat 'C:\Users\stefa\.cache\pre-commit\repop0rj34sg\arsers\jsonc-parse.js'
    npm error enoent This is related to npm not being able to find a file.
    npm error enoent
    npm error A complete log of this run can be found in: C:\Users\stefa\AppData\Local\npm-cache\_logs\2024-10-24T17_17_09_249Z-debug-0.log
Check the log at C:\Users\stefa\.cache\pre-commit\pre-commit.log

The problem is that npm searches for a file, that does not exist. But it does just not exist because of some typo

C:\Users\stefa\.cache\pre-commit\repop0rj34sg\arsers\jsonc-parse.js
                                              ^ why is the "p" missing here?

The file that is actually searched for (C:\Users\stefa\.cache\pre-commit\repop0rj34sg\parsers\jsonc-parse.js) exists on the machine.

I could reproduce this issue on all Windows machine I tested.

DavidAnson commented 1 month ago

Duplicate of #437