Module 'vim.uri' not found error at neovim 0.5 startup

Hi everyone,

I’ve been trying to prepare my config for neovim 0.5 and all the good things that come with it but I find myself stuck.

Some plugins generate the following error at startup and don’t load:

E5108: Error executing lua vim.lua:291: module 'vim.uri' not found:

It points to this line in vim.lua:

elseif require('vim.uri')[key] ~= nil then
  -- Expose all `vim.uri` functions on the `vim` module.
  t[key] = require('vim.uri')[key]
  return t[key]

I don’t read Lua super well but it seems that if it can’t find anything named vim.uri then it should just move on?

This happens with vim-airline and nvim-lspconfig.

For example, with the following init.lua:

local cmd = vim.cmd

cmd "call plug#begin('~/.vim/plugged')"
cmd "Plug 'neovim/nvim-lspconfig'"
cmd "call plug#end()"

after running :PlugInstall I get

Error detected while processing /Users/<my-user-name>/.vim/plugged/nvim-lspconfig/plugin/lspconfig.vim:                                                                                                                                                              
line   11:
E5108: Error executing lua vim.lua:291: module 'vim.uri' not found:
        no field package.preload['vim.uri']
        no file './vim/uri.lua'
        [...]

The only other place I’ve seen the problem mentioned is here but the resolution was “Nvm. I ended up building and installing the current HEAD from source.”. This doesn’t help me because I did built neovim from source (specifically from 095f5da79cb8f108b67824039952c6b225cb3dac).

That comment also mentioned that their install was probably wrong, which is likely my case as well.

Starting neovim with -u NONE and running :lua require('vim.uri') predictably triggers

E5108: Error executing lua [string ":lua"]:1: module 'vim.uri' not found:
        no field package.preload['vim.uri']
        no file './vim/uri.lua'
        [...]

Am I somehow missing a file?

I appreciate any help/pointers :slight_smile:

How did you install neovim from source? Did you run make clean && make distclean && make && sudo make install?

1 Like

Ah, good point. I had not. I was just running make and had never run make clean or make distclean. Given that I’d previously built a nightly from 6 months ago, I can see how that was a problem.

However, I just ran make clean && make distclean && make and am looking at neovim/build/bin/nvim. It has the same errors I described in the first post.

I’ve been trying to avoid running make install and basically just created an alias so that vi is neovim/build/bin/nvim, so I can come back to 0.4 easily if I need to. Maybe that’s creating problems. I’m going to try installing it using a different CMAKE_INSTALL_PREFIX as described here instead.

Ha.

I ran make install and now it works.
It seems that just running make and using neovim/build/bin/nvim was not a good idea.

Thanks a lot for your quick response @mjlbach !

You were most likely missing 0.5 runtime. You could have aliased like

alias vi="VIMRUNTIME={path to source}/runtime {path to source}/build/bin/nvim"
1 Like

I’m running into the same issue. After updating a nightly version with brew.
Somehow the $VIMRUNTIME is still linked to the old HEAD version.

vim is aliased to neovim (> alias vim = nvim)

NVIM v0.5.0-dev+f2df01900
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -Wall -Wextra
 -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -W
missing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fd
iagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_
FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20210402-78352-1xo1b0n
/build/config -I/tmp/neovim-20210402-78352-1xo1b0n/src -I/usr/local/include -I/tmp/neovi
m-20210402-78352-1xo1b0n/deps-build/include -I/Library/Developer/CommandLineTools/SDKs/M
acOSX11.1.sdk/usr/include -I/usr/local/opt/gettext/include -I/tmp/neovim-20210402-78352-
1xo1b0n/build/src/nvim/auto -I/tmp/neovim-20210402-78352-1xo1b0n/build/include
Compiled by MateoPanadero@Mathijs.multi.box

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-f2df019/share/nvim"
:checkhealth
E5009: Invalid $VIMRUNTIME: /usr/local/Cellar/neovim/HEAD-5d5e018/share/nvim/runtime