williamboman / mason.nvim

Portable package manager for Neovim that runs everywhere Neovim runs. Easily install and manage LSP servers, DAP servers, linters, and formatters.
Apache License 2.0
7.71k stars 271 forks source link

Unable to install jinja-lsp (jinja_lsp) #1758

Closed j4ck4L0up3 closed 1 month ago

j4ck4L0up3 commented 2 months ago

I've searched open issues for similar requests

I've recently downloaded the latest plugin version of mason.nvim

Problem description

Issue: Error states, "[mason-lspconfig.nvim] failed to install jinja_lsp."

I've troubleshot the issue by checking my mason.lua and changing between "jinja-lsp" and "jinja_lsp" with the latter being the initial string. ("jinja-lsp" simply stated it wasn't a valid entry, which was to be expected).

return {
    "williamboman/mason.nvim",
    dependencies = {
        "williamboman/mason-lspconfig.nvim",
        "neovim/nvim-lspconfig",
        "WhoIsSethDaniel/mason-tool-installer.nvim",
    },
    config = function()
        local mason = require("mason")
        local mason_lspconfig = require("mason-lspconfig")
        local mason_tool_installer = require("mason-tool-installer")

        mason.setup({
            ui = {
                icons = {
                    package_installed = "",
                    package_pending = "󰴲",
                    package_uninstalled = "",
                },
            },
        })

        mason_lspconfig.setup({
            ensure_installed = {
                "bashls",
                "clangd",
                "cssls",
                "eslint",
                "gopls",
                "emmet_ls",
                "htmx-lsp",
                "html",
                "jsonls",
                "tsserver",
                "jinja_lsp",
                "lua_ls",
                "autotools_ls",
                "pyright",
                "sqlls",
                "tailwindcss",
                "yamlls",
            },
        })

        mason_tool_installer.setup({
            ensure_installed = {
                "prettier",
                "golines",
                "isort",
                "black",
                "stylua",
                "clang-format",
                "rustywind",
                "sqlfmt",
                "djlint",
                "pylint",
                "golangci-lint",
                "cpplint",
            },
        })
    end,
}

Running :MasonInstall jinja_lsp or :MasonInstall jinja-lsp does not install the package. All other packages installed successfully after I fixed formatting errors and :Mason ran correctly.

Running :MasonLog produces the following:

[ERROR Wed 17 Jul 2024 11:15:06 PM EDT] ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"jinja_lsp\"".
[INFO  Wed 17 Jul 2024 11:31:12 PM EDT] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=jinja-lsp) {}
[ERROR Wed 17 Jul 2024 11:31:12 PM EDT] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=jinja-lsp) error=spawn: cargo failed with exit code - and signal -. cargo is not executable
[INFO  Wed 17 Jul 2024 11:40:42 PM EDT] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=jinja-lsp) {}
[ERROR Wed 17 Jul 2024 11:40:42 PM EDT] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=jinja-lsp) error=spawn: cargo failed with exit code - and signal -. cargo is not executable

In my lspconfig.lua, I setup mason-lspconfig with the following handers:

        mason_lspconfig.setup_handlers({
            -- default handler for installed servers
            function(server_name)
                lspconfig[server_name].setup({
                    capabilities = capabilities,
                })
            end,

            -- TODO: add go setup if needed later

            ["emmet_ls"] = function()
                lspconfig.emmet_ls.setup({
                    capabilities = capabilities,
                    filetypes = {
                        "html",
                        "typescriptreact",
                        "javascriptreact",
                        "css",
                        "sass",
                        "scss",
                        "less",
                        "svelte",
                    },
                })
            end,

            ["lua_ls"] = function()
                lspconfig.lua_ls.setup({
                    settings = {
                        Lua = {
                            diagnostics = {
                                globals = { "vim" },
                            },
                            completion = {
                                callSnippet = "Replace",
                            },
                        },
                    },
                })
            end,
        })
    end,

where jinja_lsp should use the default handler. I tried adding an additional handler for jinja_lsp, though I wasn't sure of adding additional properties:

            ["jinja_lsp"] = function()
                lspconfig.jinja_lsp.setup({
                    capabilities = capabilities,
                })
            end,

This reflected no changes. I have saved and quit nvim each time I made a change as well.

Expected behavior

Expected jinja-lsp to install with other packages.

Affected packages

jinja-lsp [jinja_lsp]

Mason output

jinja-lsp
Installing crate jinja-lsp@0.1.81…
        spawn: cargo failed with exit code - and signal -. cargo is not executable

Installation log

Debug logs:

[DEBUG Thu 18 Jul 2024 12:19:42 AM EDT] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:58: Attempting to lock package Package(name=jinja-lsp)
[DEBUG Thu 18 Jul 2024 12:19:42 AM EDT] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:70: Wrote lockfile Package(name=jinja-lsp)
[DEBUG Thu 18 Jul 2024 12:19:42 AM EDT] .../.local/share/nvim/lazy/mason.nvim/lua/mason-core/fs.lua:71: fs: mkdirp /home/j4ck4L0up3/.local/share/nvim/mason/staging/jinja-lsp
[DEBUG Thu 18 Jul 2024 12:19:42 AM EDT] ...zy/mason.nvim/lua/mason-core/installer/registry/init.lua:149: Compiling installer. jinja-lsp {}
[DEBUG Thu 18 Jul 2024 12:19:42 AM EDT] ...y/mason.nvim/lua/mason-core/installer/managers/cargo.lua:16: cargo: install "jinja-lsp" "0.1.81" {
  locked = true
}
[DEBUG Thu 18 Jul 2024 12:19:42 AM EDT] ...ocal/share/nvim/lazy/mason.nvim/lua/mason-core/spawn.lua:82: "cargo" is not executable
[DEBUG Thu 18 Jul 2024 12:19:42 AM EDT] .../.local/share/nvim/lazy/mason.nvim/lua/mason-core/fs.lua:59: fs: unlink /home/j4ck4L0up3/.local/share/nvim/mason/staging/jinja-lsp.lock
[DEBUG Thu 18 Jul 2024 12:19:42 AM EDT] .../.local/share/nvim/lazy/mason.nvim/lua/mason-core/fs.lua:47: fs: rmrf /home/j4ck4L0up3/.local/share/nvim/mason/staging/jinja-lsp
[DEBUG Thu 18 Jul 2024 12:19:42 AM EDT] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:39: Building receipt for Package(name=jinja-lsp)
[ERROR Thu 18 Jul 2024 12:19:42 AM EDT] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=jinja-lsp) error=spawn: cargo failed with exit code - and signal -. cargo is not executable

Neovim version (>= 0.7)

NVIM v0.10.0 Build type: Release LuaJIT 2.1.1713484068

Operating system/version

Linux 6.5.0-41-generic #41~22.04.2-Ubuntu SMP PREEMPT_DYNAMIC Mon Jun 3 11:32:55 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Healthcheck

==============================================================================
mason: require("mason.health").check()

mason.nvim ~
- OK mason.nvim version v1.10.0
- OK PATH: prepend
- OK Providers: 
    mason.providers.registry-api
    mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2024-07-18-smelly-area` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.`
- OK wget: `GNU Wget 1.21.2 built on linux-gnu.`
- OK curl: `curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.18`
- OK gzip: `gzip 1.10`
- OK tar: `tar (GNU tar) 1.34`
- OK bash: `GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- WARNING cargo: not available
  - ADVICE:
    - spawn: cargo failed with exit code - and signal -. cargo is not executable
- WARNING luarocks: not available
  - ADVICE:
    - spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- WARNING Ruby: not available
  - ADVICE:
    - spawn: ruby failed with exit code - and signal -. ruby is not executable
- WARNING RubyGem: not available
  - ADVICE:
    - spawn: gem failed with exit code - and signal -. gem is not executable
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- OK node: `v20.9.0`
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK Go: `go version go1.22.5 linux/amd64`
- OK python: `Python 3.10.12`
- OK java: `openjdk version "21.0.3" 2024-04-16`
- OK npm: `10.8.2`
- OK javac: `javac 21.0.3`
- OK pip: `pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)`
- OK python venv: `Ok`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 0. Remaining: 60. Limit: 60. Reset: Thu 18 Jul 2024 12:51:56 AM EDT.
  Install and authenticate via gh-cli to increase rate limit.

Screenshots

masoninstall-jinja-error

Barmaley0 commented 1 month ago

You don't have it installed cargo.

To install it you just need to install RUST with the latest version of Cargo installed. Then just restart Mason.

j4ck4L0up3 commented 1 month ago

Thanks, @Barmaley0 that fixed it, jinja_lsp is successfully installed.