LuaLS / lua-language-server

A language server that offers Lua language support - programmed in Lua
https://luals.github.io
MIT License
3.35k stars 320 forks source link

module 'global' not found when running from CLI #1660

Closed KayleMaster closed 1 year ago

KayleMaster commented 2 years ago

How are you using the lua-language-server?

Command Line

Which OS are you using?

Windows

What is the issue affecting?

Annotations, Type Checking, Completion, Diagnostics/Syntax Checking, Hover, Libraries, Formatting, Spell Checking

Expected Behaviour

Runs when ran from command line.

Actual Behaviour

C:\projectdir>C:\Desktop\sumneko\bin\lua-language-server.exe main.lua

C:\Desktop\sumneko\bin\lua-language-server.exe:main.lua:5: module 'global' not found:
        no field package.preload['global']
        no file '.\script\global.lua'
        no file '.\script\global\init.lua'
        no file 'C:\Desktop\sumneko\bin\global.dll'
stack traceback:
        [C]: in function 'require'
        main.lua:5: in main chunk
        C:\Desktop\sumneko\bin\main.lua:85: in main chunk
        [C]: in ?

Reproduction steps

  1. Go to 'project dir'
  2. Click 'lua-language-server.exe main.lua'
  3. See error (above)

Additional Notes

The project I'm testing is a Love2D project and it works in VSCode from the VSCode extension.

Log File

No log file was generated

sumneko commented 2 years ago

Should be C:\projectdir>C:\Desktop\sumneko\bin\lua-language-server.exe C:\Desktop\sumneko\main.lua or just C:\projectdir>C:\Desktop\sumneko\bin\lua-language-server.exe

JeremiahCheatham commented 1 year ago

Is there any update on this Bug? I have been writing games in lua love2d with no issues. Then an update yesterday completely broke everything. All tables defined in other files are no longer seen like said above. I just see tons and tons of undefined Global. I tried the suggested manual command above with the exact same results. it is no longer finding required modules and also no longer understanding it's a love2d project either. Again I have been having no issues before and update. I have written several games in lua recently. But this Bug is really messing me up.

sumneko commented 1 year ago

Is there any update on this Bug? I have been writing games in lua love2d with no issues. Then an update yesterday completely broke everything. All tables defined in other files are no longer seen like said above. I just see tons and tons of undefined Global. I tried the suggested manual command above with the exact same results. it is no longer finding required modules and also no longer understanding it's a love2d project either. Again I have been having no issues before and update. I have written several games in lua recently. But this Bug is really messing me up.

This issue is not a bug, please open a new issue for your problem.

JeremiahCheatham commented 1 year ago

It's the exact bug listed above.

On Thu, 10 Nov 2022, 17:20 最萌小汐, @.***> wrote:

Is there any update on this Bug? I have been writing games in lua love2d with no issues. Then an update yesterday completely broke everything. All tables defined in other files are no longer seen like said above. I just see tons and tons of undefined Global. I tried the suggested manual command above with the exact same results. it is no longer finding required modules and also no longer understanding it's a love2d project either. Again I have been having no issues before and update. I have written several games in lua recently. But this Bug is really messing me up.

This issue is not a bug, please open a new issue for your problem.

— Reply to this email directly, view it on GitHub https://github.com/sumneko/lua-language-server/issues/1660#issuecomment-1310629116, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARKSG6J4M7Z6EJFNUSS7YDTWHUVFLANCNFSM6AAAAAARQYBGGA . You are receiving this because you commented.Message ID: @.***>

sumneko commented 1 year ago

What command are you using?

JeremiahCheatham commented 1 year ago

I'm using lvim that contains lua-language-server. After an update it stopped working so i did a bunch of searching and reinstalled lvim and lua-language-server with no success.

lua-language-server no longer understands its a love file so i get all the undefined global love. I also get undefined global for anything defined in other files. lua-language-server can no longer find or load the required modules. As you listed above how to invoke it launched lua-language-server from inside the source folder and sure enough same errors he has above it can not find the required modules. I tried rewriting the required lines several different ways to see if maybe i was using some outdated syntax but nothing.

sumneko commented 1 year ago

@JeremiahCheatham Your actual problem has nothing to do with this issue. Please open a new issue and provide your log file. It's already 2:00 a.m at my side, I'll check your problem after I wakeup.

JeremiahCheatham commented 1 year ago

Ok but if you know my actual problem can you please tell me what my actual problem is so i can know it too?

carsakiller commented 1 year ago

@KayleMaster has your issue been resolved?

JeremiahCheatham commented 1 year ago

No it has not. It appears to be the exact same issue but has been aggressively ignored and spilled into new ticket and then given a similar treatment. So for anyone else with the same issue good luck.

On Sat, 12 Nov 2022, 06:58 carsakiller, @.***> wrote:

@KayleMaster https://github.com/KayleMaster has your issue been resolved?

— Reply to this email directly, view it on GitHub https://github.com/sumneko/lua-language-server/issues/1660#issuecomment-1312392410, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARKSG6NB5ZZVRB2NMJITAGDWH45Y5ANCNFSM6AAAAAARQYBGGA . You are receiving this because you were mentioned.Message ID: @.***>

KayleMaster commented 1 year ago

Should be C:\projectdir>C:\Desktop\sumneko\bin\lua-language-server.exe C:\Desktop\sumneko\main.lua or just C:\projectdir>C:\Desktop\sumneko\bin\lua-language-server.exe

This works.

@KayleMaster has your issue been resolved?

Yes