1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

neovimのバージョンを上げた際のエラー「Error executing lua vim/_init_packages.lua:0: module 'vim.lsp' no t found:」の修正方法

Last updated at Posted at 2024-08-21

これは何?

neovimのバージョンを0.4系から0.10系にアップデートしたらvim.lsp関連のパスが通ってなさそうなエラーが出たので修正方法を書きます。
結構ハマってしまったので,同じエラーの方を救済できたらと思い,筆を執りました。


発生したエラー

Error detected while processing BufReadPost Autocommands for "*"..functi
on <SNR>26_CreateMaps[1]..FileType Autocommands for "*"..function <SNR>4
9_on_window_changed[22]..<SNR>49_init[6]..airline#extensions#load:
line  220:
E5108: Error executing lua vim/_init_packages.lua:0: module 'vim.lsp' no
t found:
  • OS: Ubuntu 22.04 LTS
  • nvim: 0.10.1

いろいろ試してみた結果init.vimのdein関連の部分を消すとでなくなることがわかった。
なので,deinを入れ直してみたりしたがうまくいかず...
いろいろ調べてなんとか解決できたので


解決方法

いろいろ調べていると以下のような文言を発見した。

stack overflow
This can be caused by a mismatch between the neovim and neovim-runtime.

どうやらneovimにはneovim-runtimeというNeovimの動作に必要な追加ファイルを提供する仕組みがあり,この相性問題が関係ありそうなことがわかった。

なので,古いバージョンのnvimを完全消去してみたところ,以下のようなエラーが追加で出るようになった。

sudo apt purge neovim
Error detected while processing /home/tomita/.config/nvim/init.vim:
line   28:
E484: Can't open file /usr/share/nvim/runtime/syntax/syntax.vim
line   29:

つまり,nvim-runtimerがないということなので古いnvim-runtimeの削除には成功したようだ。

その後nvimを再インストールしてみる。
リリースノートにはsquashfs-rootを使って展開したあとのことが記載されておらず,
自分は./squash-fs-root/usr/bin/nvimのバイナリしかパスを通していなかったのでnvim-runtime側もきちんとパスを通した。

wget https://github.com/neovim/neovim/releases/download/v0.10.1/nvim.appimage
chmod +x nvim.appimage
./nvim.appimage --appimage-extract
sudo mv ./squashfs-root/usr/bin/nvim /usr/bin/nvim
sudo mv ./squashfs-root/usr/share/nvim  /usr/share/nvim

すると,vim.lspのエラーが無事消えた!


まとめ

  • Error executing lua vim/_init_packages.lua:0: module 'vim.lsp' no t found:がnvimを更新したらでるようになってしまった。
  • deinは直接関係なかった。
  • nvimを使うときには/sur/share/nvim/runtimeが必要である。
  • nvimのバイナリと上記のnvim-runtimeの相性が悪いとうまく動かなくなる。

以上,皆様も快適なvimライフを!

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?