Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua language server installation fails on OSX #319

Closed
soerenmartius opened this issue Apr 29, 2021 · 10 comments
Closed

Lua language server installation fails on OSX #319

soerenmartius opened this issue Apr 29, 2021 · 10 comments

Comments

@soerenmartius
Copy link

@soerenmartius soerenmartius commented Apr 29, 2021

When trying to execute :LspInstall lua, I get the following exception

Screenshot 2021-04-29 at 11 27 25

@rebuilt
Copy link
Contributor

@rebuilt rebuilt commented Apr 29, 2021

What's the output of

echo $(uname -s | tr "[:upper:]" "[:lower:]")

The install script expects that to be 'darwin'.

This is the set of commands LspInstall is trying to run. You can try to run them manually and see where it fails.
The install directory should be here /.local/share/nvim/lspinstall/lua

curl -L -o sumneko-lua.vsix $(curl -s https://api.github.com/repos/sumneko/vscode-lua/releases/latest | grep 'browser_' | cut -d\" -f4)
  rm -rf sumneko-lua
  unzip sumneko-lua.vsix -d sumneko-lua
  rm sumneko-lua.vsix
  chmod +x sumneko-lua/extension/server/bin/$platform/lua-language-server
  echo "#!/usr/bin/env bash" > sumneko-lua-language-server
  echo "\$(dirname \$0)/sumneko-lua/extension/server/bin/$platform/lua-language-server -E -e LANG=en \$(dirname \$0)/sumneko-lua/extension/server/main.lua \$*" >> sumneko-lua-language-server
  chmod +x sumneko-lua-language-server

If it's still failing and you can't figure it out, open an issue with the LspInstall project.

@soerenmartius
Copy link
Author

@soerenmartius soerenmartius commented Apr 29, 2021

What's the output of

echo $(uname -s | tr "[:upper:]" "[:lower:]")

The install script expects that to be 'darwin'.

This is the set of commands LspInstall is trying to run. You can try to run them manually and see where it fails.
The install directory should be here /.local/share/nvim/lspinstall/lua

curl -L -o sumneko-lua.vsix $(curl -s https://api.github.com/repos/sumneko/vscode-lua/releases/latest | grep 'browser_' | cut -d\" -f4)
  rm -rf sumneko-lua
  unzip sumneko-lua.vsix -d sumneko-lua
  rm sumneko-lua.vsix
  chmod +x sumneko-lua/extension/server/bin/$platform/lua-language-server
  echo "#!/usr/bin/env bash" > sumneko-lua-language-server
  echo "\$(dirname \$0)/sumneko-lua/extension/server/bin/$platform/lua-language-server -E -e LANG=en \$(dirname \$0)/sumneko-lua/extension/server/main.lua \$*" >> sumneko-lua-language-server
  chmod +x sumneko-lua-language-server

If it's still failing and you can't figure it out, open an issue with the LspInstall project.

it's darwin indeed.

The following line is causing the issue

unzip sumneko-lua.vsix -d sumneko-lua

results in the above mentioned error:

Archive:  sumneko-lua.vsix
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of sumneko-lua.vsix or
        sumneko-lua.vsix.zip, and cannot find sumneko-lua.vsix.ZIP, period.
@soerenmartius
Copy link
Author

@soerenmartius soerenmartius commented Apr 29, 2021

digging a bit further, the issue is actually in the curl command:

curl -s https://api.github.com/repos/sumneko/vscode-lua/releases/latest | grep 'browser_' | cut -d\" -f4
zsh: no such file or directory: https://api.github.com/repos/sumneko/vscode-lua/releases/41330053
@rebuilt
Copy link
Contributor

@rebuilt rebuilt commented Apr 29, 2021

try one of the other releases list here view-source:https://api.github.com/repos/sumneko/vscode-lua/releases. choose one listed as 'url'

@soerenmartius
Copy link
Author

@soerenmartius soerenmartius commented Apr 29, 2021

imho, the problem is that grep is taking the wrong property from the returned JSON, it's taking the url property.

{
  "url": "https://api.github.com/repos/sumneko/vscode-lua/releases/41330053", <-- this is being grepped
  "assets_url": "https://api.github.com/repos/sumneko/vscode-lua/releases/41330053/assets",
  "upload_url": "https://uploads.github.com/repos/sumneko/vscode-lua/releases/41330053/assets{?name,label}",
  "html_url": "https://github.com/sumneko/vscode-lua/releases/tag/v1.20.4",
  "id": 41330053,
  "author": {
    "login": "sumneko",
    "id": 5213431,
    "node_id": "MDQ6VXNlcjUyMTM0MzE=",
    "avatar_url": "https://avatars.githubusercontent.com/u/5213431?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/sumneko",
    "html_url": "https://github.com/sumneko",
    "followers_url": "https://api.github.com/users/sumneko/followers",
    "following_url": "https://api.github.com/users/sumneko/following{/other_user}",
    "gists_url": "https://api.github.com/users/sumneko/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/sumneko/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/sumneko/subscriptions",
    "organizations_url": "https://api.github.com/users/sumneko/orgs",
    "repos_url": "https://api.github.com/users/sumneko/repos",
    "events_url": "https://api.github.com/users/sumneko/events{/privacy}",
    "received_events_url": "https://api.github.com/users/sumneko/received_events",
    "type": "User",
    "site_admin": false
  },
  "node_id": "MDc6UmVsZWFzZTQxMzMwMDUz",
  "tag_name": "v1.20.4",
  "target_commitish": "master",
  "name": "",
  "draft": false,
  "prerelease": false,
  "created_at": "2021-04-13T04:08:38Z",
  "published_at": "2021-04-13T04:10:12Z",
  "assets": [
    {
      "url": "https://api.github.com/repos/sumneko/vscode-lua/releases/assets/34908442",
      "id": 34908442,
      "node_id": "MDEyOlJlbGVhc2VBc3NldDM0OTA4NDQy",
      "name": "lua-1.20.4.vsix",
      "label": null,
      "uploader": {
        "login": "sumneko",
        "id": 5213431,
        "node_id": "MDQ6VXNlcjUyMTM0MzE=",
        "avatar_url": "https://avatars.githubusercontent.com/u/5213431?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/sumneko",
        "html_url": "https://github.com/sumneko",
        "followers_url": "https://api.github.com/users/sumneko/followers",
        "following_url": "https://api.github.com/users/sumneko/following{/other_user}",
        "gists_url": "https://api.github.com/users/sumneko/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/sumneko/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/sumneko/subscriptions",
        "organizations_url": "https://api.github.com/users/sumneko/orgs",
        "repos_url": "https://api.github.com/users/sumneko/repos",
        "events_url": "https://api.github.com/users/sumneko/events{/privacy}",
        "received_events_url": "https://api.github.com/users/sumneko/received_events",
        "type": "User",
        "site_admin": false
      },
      "content_type": "application/vsix",
      "state": "uploaded",
      "size": 3370006,
      "download_count": 884,
      "created_at": "2021-04-13T04:10:08Z",
      "updated_at": "2021-04-13T04:10:10Z",
      "browser_download_url": "https://github.com/sumneko/vscode-lua/releases/download/v1.20.4/lua-1.20.4.vsix"
    }
  ],
  "tarball_url": "https://api.github.com/repos/sumneko/vscode-lua/tarball/v1.20.4",
  "zipball_url": "https://api.github.com/repos/sumneko/vscode-lua/zipball/v1.20.4",
  "body": ""
}

Wouldn't it make more sense to simply take the zipball_url property instead?

curl -s https://api.github.com/repos/sumneko/vscode-lua/releases/latest | jq -r '.zipball_url'
@rebuilt
Copy link
Contributor

@rebuilt rebuilt commented Apr 29, 2021

Try :PackerSync to update your plugins and install again

@soerenmartius
Copy link
Author

@soerenmartius soerenmartius commented Apr 30, 2021

Try :PackerSync to update your plugins and install again

I did that but the issue still occurs unfortunately :(

@rebuilt
Copy link
Contributor

@rebuilt rebuilt commented Apr 30, 2021

Then you have to make sure 'cmd' points to the sumneko executable on your machine.

~/.config/nvim/lua/lsp/efm-general-ls.lua

    cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"},

DATA_PATH is a global variable. You can read the value of it with

:lua print(DATA_PATH)

Check that you set it up properly with :LspInfo

Also create an issue with https://github.com/kabouzeid/nvim-lspinstall and let them know :LspInstall fails on OSX.

@soerenmartius
Copy link
Author

@soerenmartius soerenmartius commented May 10, 2021

Follow these instructions. https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)

Got it working now after some time. There are issues with getting the standalone build up and running on osx also, opened an issue in the upstream: sumneko/lua-language-server#527

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants