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.87k stars 277 forks source link

Couldn't install luacheck, linking issue #1724

Open oyeyipo opened 5 months ago

oyeyipo commented 5 months ago

I've searched open issues for similar requests

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

Problem description

While other packages' installation works, the luacheck package fails due to symbolic linking of a non-existent file at bin\luacheck.bat. When I ran MasonInstall --debug luacheck, I saw that a file luacheck is located in the bin directory which seems like the file Mason was looking for based on its content. The bat file was at C:\Users\<name>\AppData\Local\nvim-data\mason\packages\luacheck\bin.

Expected behavior

Location of the batch file without the '.bat' extension for successful symbolic linking to complete the luacheck installation.

Affected packages

Luacheck

Mason output

luacheck 1.1.0-1 depends on lua >= 5.1 (5.4-1 provided by VM: success)
luacheck 1.1.0-1 depends on argparse >= 0.6.0 (not installed)
Installing https://luarocks.org/argparse-0.7.1-1.src.rock

argparse 0.7.1-1 depends on lua >= 5.1, < 5.5 (5.4-1 provided by VM: success)
argparse 0.7.1-1 is now installed in C:\Users\<name>\AppData\Local\nvim-data\mason\packages\luacheck (license: MIT)

luacheck 1.1.0-1 depends on luafilesystem >= 1.6.3 (not installed)
Installing https://luarocks.org/luafilesystem-1.8.0-1.src.rock

luafilesystem 1.8.0-1 depends on lua >= 5.1 (5.4-1 provided by VM: success)
x86_64-w64-mingw32-gcc -O2 -c -o src/lfs.o -IC:\Program Files\Lua\lib\include src/lfs.c
x86_64-w64-mingw32-gcc  -shared -o C:\Users\<name>\AppData\Local\Temp\luarocks_build-LuaFileSystem-1.8.0-1-178057\lfs.dll src/lfs.o C:\Program Files\Lua\lib\lua54.dll -lm
luafilesystem 1.8.0-1 is now installed in C:\Users\<name>\AppData\Local\nvim-data\mason\packages\luacheck (license: MIT/X11)

luacheck 1.1.0-1 is now installed in C:\Users\<name>\AppData\Local\nvim-data\mason\packages\luacheck (license: MIT)

No existing manifest. Attempting to rebuild...
Tried to link bin "luacheck" to non-existent target "bin\\luacheck.bat".

Installation log

[INFO  31-May-24 11:12:32] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=luacheck) {}
[ERROR 31-May-24 11:14:11] ...m-data/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=luacheck) error='Tried to link bin "luacheck" to non-existent target "bin\\\\luacheck.bat".'
[ERROR 31-May-24 11:15:28] ...a/lazy/mason-lspconfig.nvim/lua/mason-lspconfig/init.lua:33: Failed to set up lspconfig integration. ...on-lspconfig.nvim/lua/mason-lspconfig/lspconfig_hook.lua:56: module 'lspconfig.util' not found:
    no field package.preload['lspconfig.util']
cache_loader: module lspconfig.util not found
cache_loader_lib: module lspconfig.util not found
    no file '.\lspconfig\util.lua'
    no file 'C:\Program Files\Neovim\bin\lua\lspconfig\util.lua'
    no file 'C:\Program Files\Neovim\bin\lua\lspconfig\util\init.lua'
    no file '.\lspconfig\util.dll'
    no file 'C:\Program Files\Neovim\bin\lspconfig\util.dll'
    no file 'C:\Program Files\Neovim\bin\loadall.dll'
    no file '.\lspconfig.dll'
    no file 'C:\Program Files\Neovim\bin\lspconfig.dll'
    no file 'C:\Program Files\Neovim\bin\loadall.dll'

Neovim version (>= 0.7)

NVIM v0.10.0 Build type: Release LuaJIT 2.1.1713484068 Run "nvim -V1 -v" for more info

Operating system/version

Windows 10

Healthcheck

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-05-30-soft-bay` is installed.

mason.nvim [Core utils] ~
- WARNING unzip: not available
  - ADVICE:
    - spawn: unzip failed with exit code - and signal -. unzip is not executable
- WARNING wget: not available
  - ADVICE:
    - spawn: wget failed with exit code - and signal -. wget is not executable
- OK curl: `curl 8.4.0 (Windows) libcurl/8.4.0 Schannel WinIDN
`
- WARNING gzip: not available
  - ADVICE:
    - spawn: gzip failed with exit code - and signal -. gzip is not executable
- OK tar: `bsdtar 3.5.2 - libarchive 3.5.2 zlib/1.2.5.f-ipp 
`
- OK pwsh: `7.4.2 Microsoft Windows 10.0.19045 Win32NT
`
- WARNING 7z: not available
  - ADVICE:
    - spawn: 7z failed with exit code - and signal -. 7z is not executable

mason.nvim [Languages] ~
- WARNING cargo: not available
  - ADVICE:
    - spawn: cargo failed with exit code - and signal -. cargo 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.cmd failed with exit code - and signal -. gem.cmd is not executable
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer.bat failed with exit code - and signal -. composer.bat is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- OK Go: `go version go1.22.3 windows/amd64`
- OK luarocks: `luarocks 3.11.0
`
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK node: `v18.12.1
`
- OK python: `Python 3.11.9
`
- OK java: `openjdk version "17.0.11" 2024-04-16
`
- OK javac: `javac 17.0.11
`
- OK pip: `pip 24.0 from C:\Users\<user>\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip (python 3.11)

`
- OK python venv: `Ok`
- OK npm: `9.2.0`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 6. Remaining: 54. Limit: 60. Reset: 31-May-24 11:40:11.
  Install and authenticate via gh-cli to increase rate limit.

Screenshots

No response

oyeyipo commented 5 months ago

Furthermore. took a look at the luacheck repo and the file exists at https://github.com/mpeterv/luacheck/blob/master/bin/luacheck.bat.

In the directory 'bin' at the repo is another file named luacheck.lua but this is not being pulled in as part of the mason's 'luacheck' package. Only a luacheck file which contains the content of https://github.com/mpeterv/luacheck/blob/master/bin/luacheck.lua

powerman commented 3 months ago

Now it fails to install it on Linux too:

Installing luarocks package luacheck@1.1.0…
Warning: Failed searching manifest: Failed extracting manifest file: failed extracting /home/powerman/.cache/luarocks/https___luarocks.org/manifest-5.1.zip
Warning: Failed searching manifest: Failed loading manifest for https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/: /home/powerman/.cache/luarocks/https___raw.githubusercontent.com_rocks-moonscript-org_moonrocks-mirror_master/manifest-5.1: No such file or directory
Warning: Failed searching manifest: Failed loading manifest for https://loadk.com/luarocks/: /home/powerman/.cache/luarocks/https___loadk.com_luarocks/manifest-5.1: No such file or directory

Error: No results matching query were found for Lua 5.1.
To check if it is available for other Lua versions, use --check-lua-versions.
egel commented 2 months ago

I've recently encountered the same problem when I set up but on macOS (Sonoma), with Mason (commit: c5e07b8).

I looked into Mason logs and noticed luarocks failing to be installed. I soleved my problem by installing missing luarocks via brew:

brew install luarocks

It may not resolve the original problem on Windows machines, although hoping it may guide you to quicker find the solution on your hardware.

powerman commented 2 months ago

I've luarocks-3.11.1 installed by OS (Gentoo linux) package manager, but this doesn't resolve the issue for me.