vhyrro / luarocks.nvim

Easily install luarocks with lazy.nvim
The Unlicense
64 stars 5 forks source link

luarocks is not executable #15

Open qZhang88 opened 3 months ago

qZhang88 commented 3 months ago

Following the guide for install neorg with lazy.nvim. There is error during building.

Error executing vim.schedule lua callback: Vim:E475: Invalid value for argument cmd: '/home/x/.local/share/nvim/lazy/luarocks.nvim/.rocks/bin/luarocks' is not executable                                                  
stack traceback:
        [C]: in function 'system'
        ...hare/nvim/lazy/luarocks.nvim/lua/luarocks-nvim/rocks.lua:39: in function 'ensure'
        /home/x/.local/share/nvim/lazy/neorg/build.lua:14: in function </home/x/.local/share/nvim/lazy/neorg/build.lua:9>
0x546F6D commented 3 months ago

Similar error on windows: ..\nvim-data\lazy\luarocks.nvim\.rocks\bin\luarocks.bat' is not executable There is no directory called ".rocks" inside luarocks.nvim\

qZhang88 commented 3 months ago

Figure this out, need to install lua5.1 with header to rebuild luarocks.nvim, then reinstall neorg

sudo apt install liblua5.1-dev

# open nvim
:Lazy build luarocks.nvim
0x546F6D commented 3 months ago

Indeed, on windows too, it was silently failing with error code 0 because it could not find the lua.h file However, there are a few more issues that popped up afterward, like:

Thanood commented 3 months ago

I'm on windows, too. Using luajit (https://github.com/DevelopersCommunity/cmake-luajit) via winget and Neovim v0.9.5 So I guess at least it's not a scoop problem, @0x546F6D 😃

There is no bin directory inside .rocks after installation. I've copied the .bat files from .rocks into a newly created bin directory and luarocks (even neorg) builds again.

After reopening neovim, another error appears for me:

Unable to load the luarocks package loader. Try re-running the build stage (`:Lazy build luarocks.nvim`). Full trace: module 'luarocks.loader' not found:
    no field package.preload['luarocks.loader']
cache_loader: module luarocks.loader not found
cache_loader_lib: module luarocks.loader not found
    no file '.\luarocks\loader.lua'
    no file 'C:\Program Files\Neovim\bin\lua\luarocks\loader.lua'
    no file 'C:\Program Files\Neovim\bin\lua\luarocks\loader\init.lua'
    no file 'C:\Users\...\AppData\Local\nvim-data\lazy\luarocks.nvim\.rocks\share\lua\5.1\luarocks\loader.lua'
    no file 'C:\Users\...\AppData\Local\nvim-data\lazy\luarocks.nvim\.rocks\share\lua\5.1\luarocks\loader\init.lua'
    no file '.\luarocks\loader.dll'
    no file 'C:\Program Files\Neovim\bin\luarocks\loader.dll'
    no file 'C:\Program Files\Neovim\bin\loadall.dll'
    no file 'C:\Users\...\AppData\Local\nvim-data\lazy\luarocks.nvim\.rocks\lib\lua\5.1\luarocks\loader.dll'
    no file '.\luarocks.dll'
    no file 'C:\Program Files\Neovim\bin\luarocks.dll'
    no file 'C:\Program Files\Neovim\bin\loadall.dll'
    no file 'C:\Users\...\AppData\Local\nvim-data\lazy\luarocks.nvim\.rocks\lib\lua\5.1\luarocks.dll'

I'm no lua expert at all but it seems that module paths on windows are different maybe?

0x546F6D commented 3 months ago

What I did after copying the .rocks folder from AppData/Local/Temp/nvim.0/ to nvim-data/lazy/luarocks.nvim, was:

And it seems to work right now.. But yes, right now I am not trying to fix it, just trying to understand what is happening.

Thanood commented 3 months ago

That does indeed get rid of error messages, Neorg doesn't want to start, though. I'll look into that. 😃

fingolfin19 commented 3 months ago

Was having problems on windows too. As a work around I found it easier to scoop install lua+luarocks then install neorg through luarocks and add the luarocks path to Neovim's package path.

package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/scoop/persist/luarocks/rocks/share/lua/5.1/?/init.lua;"
package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/scoop/persist/luarocks/rocks/share/lua/5.1/?.lua;"
vhyrro commented 3 months ago

Thanks for all of your testing. This should be fixed now on the latest update as part of #17! Let me know if it solves anything :)

Thanood commented 3 months ago

@vhyrro I've reinstalled (clean + install) luarocks.nvim and neorg and now it works like a charm! 👍 Thanks a lot! ❤️

fingolfin19 commented 3 months ago

So how does one install the Lua header files on Windows (I'm using scoop for current neovim/lua stuffs)? I'm still not getting a .rocks directory in the plugin path, which is a bummer because

I found it easier to scoop install lua+luarocks then install neorg through luarocks and add the luarocks path to Neovim's package path.

package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/scoop/persist/luarocks/rocks/share/lua/5.1/?/init.lua;"
package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/scoop/persist/luarocks/rocks/share/lua/5.1/?.lua;"

no longer works (even after removing the change in Neorg that explicitly tries to use luarocks.nvim).

I get same issue as https://github.com/nvim-neorg/neorg/issues/1363 when installing dependencies through system luarocks.

Edit: Of course, the next thing I try after commenting works. Dirman wasn't loading because pathlib is now a dependency, but it wasn't being pulled in when I ran luarocks install neorg. I tried luarocks install pathlib earlier, but I just realized the rock name is actually pathlib.nvim.

So luarocks install neorg, luarocks install pathlib.nvim, then override Neorg's build.lua in Lazy, and everything works for me again.

linguini1 commented 2 months ago

I also had a similar issue. Seeing the previous comments, I tried performing a :Lazy build luarocks.nvim at which point the error message said that Lua couldn't be found on my system. Re-installing the latest version of Lua via choco install lua resolved that issue, at which point I could :Lazy build luarocks.nvim and :Lazy build neorg. Everything is working fine now!

avonmoll commented 3 weeks ago

Edit: running brew install luajit worked to prevent this problem


I'm getting this error on a new macbook (arm version). I have Lua 5.4.6 installed via homebrew. I could not get 5.1 because homebrew says its deprecated. :Lazy build luarocks.nvim fails with the following

  Performing luarocks `./configure` if Unix systems
...hare/nvim/lazy/luarocks.nvim/lua/luarocks-nvim/build.lua:137: Failed to install luarocks:                       
Configuring LuaRocks version dev...                                                                                

Lua 5.1 interpreter not found in $PATH                                                                             
You may want to use the flags --with-lua, --with-lua-bin and/or --lua-version                                      
Run ./configure --help for details.                                                                                

configure failed.