lunarvim国内安装踩坑记录
2023-2-21
·
hexWers

只能说…真t的一波三折,本文只是简单记录一下一些坑,完整安装步骤就不赘述了

参考:

环境

  • 操作系统:ArchLinux
  • neovim版本:0.8.3
  • 终端环境:zsh

过程

官方的安装教程是输入

LV_BRANCH='release-1.2/neovim-0.8' bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/fc6873809934917b470bff1b072171879899a36b/utils/installer/install.sh)

注意:官方的安装脚本随时会改动,用旧的脚本可能会出现各种问题,如果选择旧的脚本安装,望珍重

即可自行安装完成

但是实际上吧,国内会无法安装,因为无法直接链接到github,很多的库都不无法直接下载

所以需要代理,这里我说一下我使用的两款代理软件clashforwindows的linux版和clashforlinux

但是在我开启代理之后安装过程依旧停滞或者报错

这是我最开始的时候,用官方脚本下载下来安装,但是发生了错误

 ~/app/lunarvim sudo bash lvim_install.sh base 16:12:54 98% 

      88\                                                   88\
      88 |                                                  \__|
      88 |88\   88\ 888888$\   888888\   888888\ 88\    88\ 88\ 888888\8888\
      88 |88 |  88 |88  __88\  \____88\ 88  __88\\88\  88  |88 |88  _88  _88\
      88 |88 |  88 |88 |  88 | 888888$ |88 |  \__|\88\88  / 88 |88 / 88 / 88 |
      88 |88 |  88 |88 |  88 |88  __88 |88 |       \88$  /  88 |88 | 88 | 88 |
      88 |\888888  |88 |  88 |\888888$ |88 |        \$  /   88 |88 | 88 | 88 |
      \__| \______/ \__|  \__| \_______|\__|         \_/    \__|\__| \__| \__|

--------------------------------------------------------------------------------
Detecting platform for managing any additional neovim dependencies
--------------------------------------------------------------------------------
Would you like to install LunarVim's NodeJS dependencies: neovim, tree-sitter-cli?
[y]es or [n]o (default: no) : y
Installing node modules with yarn..
yarn global v1.22.19
warning package.json: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "neovim@4.10.1" with binaries:
      - neovim-node-host
success Installed "tree-sitter-cli@0.20.7" with binaries:
      - tree-sitter
Done in 43.25s.
All NodeJS dependencies are successfully installed
--------------------------------------------------------------------------------
Would you like to install LunarVim's Python dependencies: pynvim?
[y]es or [n]o (default: no) : y
Verifying that pip is available..
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Installing with pip..
Requirement already satisfied: pynvim in /root/.local/lib/python3.9/site-packages (0.4.3)
Requirement already satisfied: greenlet in /home/hex/anaconda3/lib/python3.9/site-packages (from pynvim) (1.1.1)
Requirement already satisfied: msgpack>=0.5.0 in /home/hex/anaconda3/lib/python3.9/site-packages (from pynvim) (1.0.3)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
All Python dependencies are successfully installed
--------------------------------------------------------------------------------
Would you like to install LunarVim's Rust dependencies: fd::fd-find, rg::ripgrep?
[y]es or [n]o (default: no) : y
Installing missing Rust dependency with cargo
    Updating crates.io index
     Ignored package `fd-find v8.7.0` is already installed, use --force to override
warning: be sure to add `/root/.cargo/bin` to your PATH to be able to run the installed binaries
All Rust dependencies are successfully installed
--------------------------------------------------------------------------------
Backing up old /root/.config/lvim to /root/.config/lvim.old
--------------------------------------------------------------------------------
Backing up old /root/.local/share/lunarvim to /root/.local/share/lunarvim.old
--------------------------------------------------------------------------------
Backing up old /root/.cache/lvim to /root/.cache/lvim.old
--------------------------------------------------------------------------------
Cloning LunarVim configuration
正克隆到 '/root/.local/share/lunarvim/lvim'...
remote: Enumerating objects: 17060, done.
remote: Counting objects: 100% (178/178), done.
remote: Compressing objects: 100% (63/63), done.
remote: Total 17060 (delta 101), reused 143 (delta 85), pack-reused 16882
接收对象中: 100% (17060/17060), 13.82 MiB | 5.65 MiB/s, 完成.
处理 delta 中: 100% (10756/10756), 完成.
--------------------------------------------------------------------------------
Installing LunarVim shim
make: 进入目录“/root/.local/share/lunarvim/lvim”
starting LunarVim bin-installer
bash ./utils/installer/install_bin.sh
You can start LunarVim by running: /root/.local/bin/lvim
make: 离开目录“/root/.local/share/lunarvim/lvim”
Creating desktop file
Preparing Packer setup
Initializing first time setup
Error detected while processing /root/.local/share/lunarvim/lvim/init.lua:
Plugin lunar.nvim is not installedError detected while processing command line:
E492: Not an editor command: PackerSync
Error detected while processing VimEnter Autocommands for "*":
Plugin project.nvim is not installed
Plugin lualine.nvim is not installed
Plugin alpha-nvim is not installed

我在谷歌搜不到结果,只能说很奇怪…

根据PackerSync,我看了一下packer的库,发现我clone过了,于是删除文件夹

搜着搜着发现了一个UP主在B站上发了安装视频和博客,于是用他家改写的手动脚本安装,又发生了问题,用自定义脚本安装的过程很长,我等待了20分钟依旧无法安装成功,于是使用了博客里的镜像文件替换,但是报错了zsh: command not found: lvim

期间还出现了使用安装脚本权限不够,[ERROR]: Unable to verify plugins, make sure to manually run ':Lazy sync' when starting lvim for the first time.等的问题

解决方式

使用官方脚本

请务必使用官方的脚本安装,地址,因为脚本不一定相同,旧的会有问题

保持环境纯净

我是clone了packer,所以删除了,lunarvim会自己安装

代理问题

如果修改了代理,需要重新开一个终端,原来的终端其实是没有生效的

配置环境变量

关于环境变量,参考archwiki,有几种方式

第一种,我用的是zsh,所以配置zsh的环境变量(只是举个例子,zsh还有很多种配置的方式)。在~/.zshenv中,输入

typeset -U path
path=(~/.local/bin $path)

第二种,配置.bashrc文件

export PATH="$PATH:/home/$USER/.local/bin"

然后记得source一下使他们生效