fnando / vscode-linter

Extension for code linting, all in one package. New linters can be easily added through an extension framework.
https://marketplace.visualstudio.com/items?itemName=fnando.linter
MIT License
63 stars 16 forks source link

Markdownlint error: `spawnSync markdownlint ENOENT` #43

Open romainf-ubi opened 10 months ago

romainf-ubi commented 10 months ago

I have a bug with Linter and Markdownlint.

I'm on Windows and I've installed Markdownlint using npm install -g markdownlint-cli, but I get this error:

Error while running "markdownlint": spawnSync markdownlint ENOENT

I restarted my machine, just in case, but same error.

Here's the whole output (regarding markdownlint, not the other linters, which are not installed anyway):

Linter config: {
  "capabilities": [
    "fix-inline"
  ],
  "command": [
    "markdownlint",
    "--json",
    [
      "$fixAll",
      "--fix"
    ],
    [
      "$config",
      "--config",
      "$config"
    ],
    "--stdin"
  ],
  "configFiles": [
    ".markdownlint.json",
    ".markdownlint.yaml",
    ".markdownlint.yml",
    ".markdownlintrc"
  ],
  "enabled": true,
  "languages": [
    "markdown"
  ],
  "name": "markdownlint",
  "url": "https://github.com/DavidAnson/markdownlint"
}
Args: {
  "$rootDir": "c:\\path\\to\\root\\dir",
  "$file": "/c:/path/to/file.md",
  "$extension": ".md",
  "$extensionBare": "md",
  "$config": "",
  "$debug": false,
  "$lint": true,
  "$language": "markdown",
  "$shebang": ""
}
{
  "rootDir": "c:\\path\\to\\root\\dir",
  "configFile": "",
  "command": [
    "markdownlint",
    "--json",
    "--stdin"
  ]
}
Error while running "markdownlint": spawnSync markdownlint ENOENT
markdownlint's command took 4ms

(I only edited the paths for privacy reasons)

I used cmd to run markdownlint --json --stdin < c:/path/to/file.md (without the leading / in the file path), and it worked as expected.

romainf-ubi commented 10 months ago

Apparently ENOENT means "ENOENT No such file or directory (POSIX.1-2001)" (source: https://www.man7.org/linux/man-pages/man3/errno.3.html)