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

module 'schemastore' not found #32

Closed
mrt181 opened this issue May 15, 2024 · 2 comments
Closed

module 'schemastore' not found #32

mrt181 opened this issue May 15, 2024 · 2 comments

Comments

@mrt181
Copy link

mrt181 commented May 15, 2024

This is my nvim-lspconfig.lua config

return {
  "neovim/nvim-lspconfig",
  dependencies = {
    { "b0o/schemastore.nvim" },
  },
  opts = {
    servers = {
      jsonls = {
	settings = {
	  json = {
	    schemas = require("schemastore").json.schemas(),
	    validate = { enable = true },
	  },
	},
      },
      yamlls = {
	settings = {
	  yaml = {
	    schemaStore = {
	      enable = true,
	      url = "https://www.schemastore.org/api/json/catalog.json",
	    },
	    schemas = require("schemastore").yaml.schemas(),
	  },
	},
      },
    },
  },
}

I get this error:

  Error  11:29:20 notify.error lazy.nvim Failed to load `plugins.nvim-lspconfig`

/home/martin/.config/nvim/lua/plugins/nvim-lspconfig.lua:61: module 'schemastore' not found:
	no field package.preload['schemastore']
cache_loader: module schemastore not found
cache_loader_lib: module schemastore not found
	no file './schemastore.lua'
	no file '/build/nvim/parts/nvim/build/.deps/usr/share/luajit-2.1/schemastore.lua'
	no file '/usr/local/share/lua/5.1/schemastore.lua'
	no file '/usr/local/share/lua/5.1/schemastore/init.lua'
	no file '/build/nvim/parts/nvim/build/.deps/usr/share/lua/5.1/schemastore.lua'
	no file '/build/nvim/parts/nvim/build/.deps/usr/share/lua/5.1/schemastore/init.lua'
	no file './schemastore.so'
	no file '/usr/local/lib/lua/5.1/schemastore.so'
	no file '/build/nvim/parts/nvim/build/.deps/usr/lib/lua/5.1/schemastore.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'

# stacktrace:
  - ~/.config/nvim/lua/plugins/nvim-lspconfig.lua:61
  - ~/.config/nvim/lua/config/lazy.lua:10
  - ~/.config/nvim/init.lua:2

How can I fix that?

@b0o
Copy link
Owner

b0o commented May 15, 2024

Try using a config function instead of an opts table:

return {
  "neovim/nvim-lspconfig",
  dependencies = {
    { "b0o/schemastore.nvim" },
  },
  config = function()
    require("lspconfig").jsonls.setup {
      settings = {
        json = {
          schemas = require("schemastore").json.schemas(),
          validate = { enable = true },
        },
      },
    }

    require("lspconfig").yamlls.setup {
      settings = {
        yaml = {
          schemaStore = {
            enable = true,
            url = "https://www.schemastore.org/api/json/catalog.json",
          },
          schemas = require("schemastore").yaml.schemas(),
        },
      },
    }
  end,
}

@b0o
Copy link
Owner

b0o commented May 29, 2024

I'm going to close this issue. If you're still experiencing this error, please feel free to re-open it.

@b0o b0o closed this as completed May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants