yetone / avante.nvim

Use your Neovim like using Cursor AI IDE!
Apache License 2.0
6.4k stars 229 forks source link

Install Failed via vim-plug #453

Closed Kaoruha closed 1 month ago

Kaoruha commented 1 month ago

I installed the lib via vim-plug, but got the following error log.

1 Updated. Elapsed time: 2.031265 sec.
1 [====================x] 2
3 - Finishing ... Done! 4 x Post-update hook for avante.nvim ... Vim:E492: Not an editor command: AvanteBuild how to fix~

snowphone commented 1 month ago

Does Plug 'yetone/avante.nvim', { 'branch': 'main', 'do': { -> avante#build() }, 'on': 'AvanteAsk' } work on the latest vim-plug & neovim 0.10.1? When I try it, it raises an error like this:

x Post-update hook for avante.nvim ... Vim(source):E5113: Error while calling lua chunk: /home/sixtyfive/.vim/plugged/avante.nvim/plugin/avante.lua:13: module 'avante.clipboard' not found:
    no field package.preload['avante.clipboard']
    no file './avante/clipboard.lua'
    no file '/home/runner/work/neovim/neovim/.deps/usr/share/luajit-2.1/avante/clipboard.lua'
    no file '/usr/local/share/lua/5.1/avante/clipboard.lua'
    no file '/usr/local/share/lua/5.1/avante/clipboard/init.lua'
    no file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/avante/clipboard.lua'
    no file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/avante/clipboard/init.lua'
    no file './avante/clipboard.so'
    no file '/usr/local/lib/lua/5.1/avante/clipboard.so'
    no file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/avante/clipboard.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
    no file './avante.so'
    no file '/usr/local/lib/lua/5.1/avante.so'
    no file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/avante.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
    [C]: in function 'require'
    /home/sixtyfive/.vim/plugged/avante.nvim/plugin/avante.lua:13: in main chunk
aarnphm commented 1 month ago

did you call require("avante").setup()? please read the readme

snowphone commented 1 month ago

Here's my init.lua. In detail, after .vimrc (with vim-plug) in sourced, init.lua is invoked in my configuration.

...
require('img-clip').setup({
    -- recommended settings
    default = {
        embed_image_as_base64 = false,
        prompt_for_file_name = false,
        drag_and_drop = {
            insert_mode = true,
        },
    },
})
require('render-markdown').setup {
    file_types = { "markdown", "Avante" },
    enable = true,
}
require('avante_lib').load()
require('avante').setup {
    provider = "openai",
    mappings = {
        submit = {
            normal = "<C-j>",
            insert = "<C-j>",
        },
    },
}
...

Since I use openapi, I popped out copilot.lua and related config.

Kaoruha commented 1 month ago
❯ nvim --version
NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info

Here's my init.vim configuration file, with unrelated plugin sections removed.

call plug#begin('~/.config/nvim/plugged')

" Deps
Plug 'stevearc/dressing.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'MunifTanjim/nui.nvim'

" Optional deps
Plug 'nvim-tree/nvim-web-devicons' "or Plug 'echasnovski/mini.icons'
Plug 'HakonHarnes/img-clip.nvim'
Plug 'zbirenbaum/copilot.lua'

" Yay, pass source=true if you want to build from source
Plug 'yetone/avante.nvim', { 'branch': 'main', 'do': { -> avante#build() }, 'on': 'AvanteAsk' }

call plug#end()

lua << EOF

require('avante_lib').load()

EOF
Updated. Elapsed time: 7.073995 sec.                                                                                                                                                                                         
  1 [====================x]
  2 
  3 - Finishing ... Done!
  4 x Post-update hook for avante.nvim ... Vim(source):E5113: Error while calling lua chunk: ...kaoru/.config/nvim/plugged/avante.nvim/plugin/avante.lua:13: module 'avante.clipboard' not found:^@ no field package.preload['ava
  5 - avante.nvim: Already up to date.
  6 - indentLine: Already installed

Seems faild at buildindg function.

I have checked runtimepath, and the path for avante.nvim was not added.

aarnphm commented 1 month ago

541 should address this.

snowphone commented 1 month ago

I tried with my configuration and @Kaoruha's minimal configuration, but it failed in both cases. I double-checked that the vim-plug downloaded the latest main branch (33c9ac2).

It seems lazy loading technique ('on': 'AvanteAsk') does not work on vim-plug. Maybe avante.nvim must be loaded before invoking any lua command (such as require).

x Post-update hook for avante.nvim ... Vim(source):E5113: Error while calling lua chunk: /Users/junohmoon/.vim/plugged/avante.nvim/plugin/avante.lua:13: module 'avante.clipboard' not found:
    no field package.preload['avante.clipboard']
    no file './avante/clipboard.lua'
    no file '/usr/local/share/luajit-2.1/avante/clipboard.lua'
    no file '/usr/local/share/lua/5.1/avante/clipboard.lua'
    no file '/usr/local/share/lua/5.1/avante/clipboard/init.lua'
    no file './avante/clipboard.so'
    no file '/usr/local/lib/lua/5.1/avante/clipboard.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
    no file './avante.so'
    no file '/usr/local/lib/lua/5.1/avante.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
    [C]: in function 'require'
    /Users/junohmoon/.vim/plugged/avante.nvim/plugin/avante.lua:13: in main chunk
snowphone commented 1 month ago

As a result, I use Plug 'yetone/avante.nvim', { 'branch': 'main', 'do': { -> avante#build('source=true') } } to give up lazy loading and confirm it runs without errors.

ericzwong commented 1 month ago

As a result, I use Plug 'yetone/avante.nvim', { 'branch': 'main', 'do': { -> avante#build('source=true') } } to give up lazy loading and confirm it runs without errors.

When I tried to run the new one, I encountered "avante.nvim ... Vim(return):E118: Too many arguments for function: join" on my side.

aarnphm commented 1 month ago

@ericzwong sorry for the ping, can you try with this https://github.com/yetone/avante.nvim/pull/550?

ericzwong commented 1 month ago

@ericzwong sorry for the ping, can you try with this #550?

It works for me.

aarnphm commented 1 month ago

Thanks for going through all the trouble, appreciate it a ton