williamboman/nvim-lsp-installer

Can't install `teal_ls`: `luarocks` can't be found on path

EtiamNullam opened this issue ยท 9 comments

Problem description

Running LspInstall teal_ls will fail saying luarocks is not installed:

teal_ls (failed)
Could not find executable "luarocks" in path.
spawn: luarocks failed with no exit code. 

Output of luarocks in cmd:

Configuration:
   Lua:
      Version    : 5.1
      Interpreter: C:\Users\user\hererocks\bin/lua.exe (ok)
      LUA_DIR    : C:\Users\user\hererocks (ok)
      LUA_BINDIR : C:\Users\user\hererocks\bin (ok)
      LUA_INCDIR : C:\Users\user\hererocks\include (ok)
      LUA_LIBDIR : C:\Users\user\hererocks\bin (ok)

   Configuration files:
      System  : C:/Users/user/hererocks/luarocks/config-5.1.lua (ok)
      User    : C:/Users/user/AppData/Roaming/luarocks/config-5.1.lua (not found)

   Rocks trees in use:
      C:\Users\user\AppData\Roaming/luarocks ("user")
      c:\users\user\hererocks\ ("system")

As you can see luarocks was installed via hererocks

Neovim version (>= 0.7)

NVIM v0.7.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Operating system/version

Windows 10

I've recently downloaded the latest plugin version of both nvim-lsp-installer and nvim-lspconfig

  • Yes

Affected language servers

teal_ls

Actual behavior

teal_ls won't install saying luarocks is not found on path.

Expected behavior

teal_ls should install

LspInstallInfo output

teal_ls (failed)
Could not find executable "luarocks" in path.
spawn: luarocks failed with no exit code.

Installation log

[INFO  5/28/2022 11:16:25 AM] ...ug\nvim-lsp-installer/lua/nvim-lsp-installer/ui/init.lua:735: Starting install server_name="teal_ls", requested_version=""
[ERROR 5/28/2022 11:16:25 AM] ...im-lsp-installer/lua/nvim-lsp-installer/core/process.lua:151: Failed to spawn process. cmd="luarocks", err="ENOENT: no such file or directory"
[ERROR 5/28/2022 11:16:25 AM] ...installer/lua/nvim-lsp-installer/core/installer/init.lua:79: Installation failed, name="teal_ls", error="spawn: luarocks failed with no exit code. "
[INFO  5/28/2022 11:16:25 AM] ...ug\nvim-lsp-installer/lua/nvim-lsp-installer/ui/init.lua:754: Installation completed server_name="teal_ls", success=false

Healthcheck

nvim-lsp-installer: require("nvim-lsp-installer.health").check()
========================================================================
## nvim-lsp-installer report
  - OK: neovim version >= 0.7.0
  - WARNING: **luarocks**: not available
  - WARNING: **Composer**: not available
  - WARNING: **julia**: not available
  - OK: **Ruby**: `ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x64-mingw-ucrt]`
  - OK: **node**: `v16.14.0`
  - OK: **gzip**: `gzip 1.10`
  - OK: **python**: `Python 2.7.18`
  - OK: **tar**: `bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.5.f-ipp`
  - OK: **PHP**: `PHP 7.3.0 (cli) (built: Dec  6 2018 01:54:19) ( ZTS MSVC15 (Visual C++ 2017) x64 )`
  - OK: **python3_host_prog**: `Python 3.10.4`
  - OK: **curl**: `curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL`
  - OK: **Go**: `go version go1.18.2 windows/amd64`
  - OK: **python3**: `Python 3.10.4`
  - OK: **cargo**: `cargo 1.54.0 (5ae8d74b3 2021-06-22)`
  - OK: **wget**: `GNU Wget 1.21.3 built on mingw32.`
  - OK: **java**: `Ok`
  - OK: **javac**: `javac 17.0.2`
  - OK: **pip3**: `pip 22.0.4 from C:\Users\user\scoop\apps\python\current\lib\site-packages\pip (python 3.10)`
  - OK: **pip**: `pip 20.3.4 from C:\Users\user\AppData\Roaming\Python\Python27\site-packages\pip (python 2.7)`
  - OK: **npm**: `8.5.4`
  - OK: GitHub API rate limit. Used: 13. Remaining: 47. Limit: 60. Reset: 5/28/2022 11:45:39 AM.

Screenshots

No response

Hello! Hm, weird. The :checkhealth, logs and :LspInstallInfo outputs sort of contradict each other tbh. Are you sure luarocks is executable in the same shell session that you launch neovim in? Will have to look deeper into this next time I'm at a Windows PC.

Yeah, weird.

I can run !luarocks in neovim cmdline and get the same output so I guess shell session is not a problem.

EDIT: isn't there a need to append .bat (or in some cases .cmd) for Windows? Seems like I can run it using both luarocks.bat and luarocks.

EDIT: isn't there a need to append .bat (or in some cases .cmd) for Windows? Seems like I can run it using both luarocks.bat and luarocks.

Yeah, although this really depends on the PATHEXT environment variable. Note however that libuv (which neovim and this plugin uses to spawn processes) does not respect PATHEXT. From just reading the online docs I assumed luarocks was installed as a binary (.exe) on Windows, but if it's a .bat script we probably need to adjust things

I might be wrong but seems like luarocks always comes as a .bat script for Windows.

EDIT: luarocks on scoop comes as an exe.

Could you see if branch fix/luarocks-windows (#731) fixes this?

Yes, it works. I did the same locally.

Just wondering if the same should be added to lua\nvim-lsp-installer\health\init.lua:13 as its done for other package managers there? healthcheck still fails at luarocks for me.

Sadly it still doesn't work for me but its installing correctly!

I had to also add cmd for server setup command, like this:

cmd = {
  'teal-language-server.bat'
},

...otherwise I will get:

Spawning language server with cmd: `teal-language-server` failed. The language server is either not installed, missing from PATH, or not executable.

Now I'm stuck at:

[ERROR][2022-05-28 23:32:08] .../vim/lsp/rpc.lua:420	"rpc"	"teal-language-server.bat"	"stderr"	"C:\\Users\user\hererocks\\bin\\lua.exe: error loading module 'tealls.util' from file 'C:/Users\user\AppData/Local/nvim-data/lsp_servers/teal_ls/share/lua/5.1/tealls\\util.lua':
	...m-data/lsp_servers/teal_ls/share/lua/5.1/tealls\\util.lua:92: unexpected symbol near '/'
stack traceback:
	[C]: at 0x7ff911f8a800
	[C]: in function 'require'
	...im-data/lsp_servers/teal_ls/share/lua/5.1/tealls\\rpc.lua:4: in main chunk
	[C]: in function 'require'
	...m-data/lsp_servers/teal_ls/share/lua/5.1/tealls/init.lua:3: in main chunk
	[C]: in function 'require'
	...-5.1\	eal-language-server\\dev-1\\bin\	eal-language-server:2: in main chunk
	[C]: at 0x7ff74ee623b0

...and it looks like its a problem with language server itself, maybe I'm wrong but looks like there is // operator used (divide floor), while its not acceptable in lua 5.1.

But I guess that's all out of context of this issue.

Just wondering if the same should be added to lua\nvim-lsp-installer\health\init.lua:13 as its done for other package managers there? healthcheck still fails at luarocks for me.

Ah good catch, fixed in #732.

I had to also add cmd for server setup command, like this:

This should be fixed in lspconfig then! If you'd like you can fix this yourself and open a PR there, see ltex for reference!

@EtiamNullam How did you install Luarocks? I'm struggling a bit with finding a functional one

I also had a problem with finding a good one, ended up with https://github.com/mpeterv/hererocks

EDIT: @williamboman as lua51 was just added to ScoopInstaller/Versions I suggest using scoop (add bucket versions )
EDIT2: if you want to use hererocks better use this one as its maintained: https://github.com/luarocks/hererocks, IMO better to use scoop