Error when I try to install plugins on Windows
I am using vim-plug to manage my plugins both on Windows and Linux. But on Windows, I encounter errors sometimes when I try to install new plugins using PlugInstall command. The error is shown blow:
|| Error detected while processing function
C:\Users\Administrator\AppData\Local\nvim\autoload\plug.vim|604| <SNR>2_install[1]
C:\Users\Administrator\AppData\Local\nvim\autoload\plug.vim|1015| <SNR>2_update_impl[58]
C:\Users\Administrator\AppData\Local\nvim\autoload\plug.vim|327| <SNR>2_git_version_requirement[2]
C:\Users\Administrator\AppData\Local\nvim\autoload\plug.vim|2039| <SNR>2_system[6]
|| E482: Can't open file C:\Users\ADMINI~1\AppData\Local\Temp\nvimBCqYQf\10.bat for writing: no such file or directory
|| Error detected while processing function
C:\Users\Administrator\AppData\Local\nvim\autoload\plug.vim|604| <SNR>2_install[1]
C:\Users\Administrator\AppData\Local\nvim\autoload\plug.vim|1015| <SNR>2_update_impl[58]
C:\Users\Administrator\AppData\Local\nvim\autoload\plug.vim|327| <SNR>2_git_version_requirement[2]
|| E171: Missing :endif
This error seems random and only appear after I have used nvim-qt for some time. If I quit nvim-qt and restart, I can use PlugInstall without any error.
version info
NVIM v0.4.0-819-g66d127957
Build type: RelWithDebInfo
LuaJIT 2.0.5
Compilation: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe /DWIN32 /D_WINDOWS /W3 /MD /Zi /O2 /Ob1 /DNDEBUG -DMIN_LOG_LEVEL=3 /W3 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -DWIN32 -D_WIN32_WINNT=0x0600 -DINCLUDE_GENERATED_DECLARATIONS -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -IC:/projects/neovim/build/config -IC:/projects/neovim/src -IC:/projects/nvim-deps/usr/include -IC:/projects/neovim/build/src/nvim/auto -IC:/projects/neovim/build/include
Compiled by appveyor@APPVYR-WIN
Features: -acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM\sysinit.vim"
fall-back for $VIM: "C:/Program Files/nvim/share/nvim"
Run :checkhealth for more info
- Type:
- [x] Bug
- [ ] Enhancement
- [ ] Feature Request
- [ ] Question
- OS:
- [ ] All/Other
- [ ] Linux
- [ ] OS X
- [x] Windows
- Vim:
- [ ] Terminal Vim
- [ ] GVim
- [x] Neovim
Can't open file C:\Users\ADMINI~1\AppData\Local\Temp\nvimBCqYQf\10.bat
Neovim doesn't support DOS short filenames (see https://en.wikipedia.org/wiki/8.3_filename). fzf.vim uses a workaround for this https://github.com/junegunn/fzf.vim/commit/7e92b73d03cd008e248ad261208475b45bc2f128#diff-7274b7c6c87526542ef9087f2e997dfaR40. It can be ported to vim-plug for tempname() but Neovim should handle this internally.
https://github.com/neovim/neovim/issues/11250#issuecomment-545261166 suggests that it's likely not a DOS shortpath issue but it's up to Neovim to improve tempname. In the meantime, the error should be caught and hidden from the user with a try/catch.
I wanted to share my experience. This problem cropped up about a month ago or so? Same thing here, except I am in Vim/GVim and using Powershell.
In my experience, this is not random, and happens whenever any Plug* command is used. It does seem to install the plugins called for, I've gone through and downloaded the plug script a couple of times and cleared the plugged directory. No such luck.
This is also happening to me on GVim, whenever any Plug command is used. I'm using GVim 8.2 on Windows 10. The exact error message is:
Error detected while procesing function <SNR>3_install[1]..<SNR>3_update_impl[58]..<SNR>3_git_version_requirement[2]..<SNR>3_system:
line 8:
E484: Can't Open file C:\Users\Alyer\AppData\Local\Temp\VIo274B.tmp
Error detecetd while processing function <SNR>3_instal[1]..<SNR>3_update_impl[58]..<SNR>3_git_version_requirement:
line 2:
E171: Missing :endif
Version info is:
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec 12 2019 13:30:17)
MS-Windows 32-bit GUI version with OLE support
Compiled by mool@tororo
Huge version with GUI. Features included (+) or not (-):
+acl +eval +multi_lang -tag_any_white
+arabic +ex_extra +mzscheme/dyn +tcl/dyn
+autocmd +extra_search +netbeans_intg -termguicolors
+autochdir -farsi +num64 +terminal
+autoservername +file_in_path +ole -termresponse
+balloon_eval +find_in_path +packages +textobjects
-balloon_eval_term +float +path_extra +textprop
+browse +folding +perl/dyn -tgetent
++builtin_terms -footer +persistent_undo +timers
+byte_offset +gettext/dyn +popupwin +title
+channel -hangul_input -postscript +toolbar
+cindent +iconv/dyn +printer +user_commands
+clientserver +insert_expand +profile +vartabs
+clipboard +job +python/dyn +vertsplit
+cmdline_compl +jumplist +python3/dyn +virtualedit
+cmdline_hist +keymap +quickfix +visual
+cmdline_info +lambda +reltime +visualextra
+comments +langmap +rightleft +viminfo
+conceal +libcall +ruby/dyn +vreplace
+cryptv +linebreak +scrollbind -vtp
+cscope +lispindent +signs +wildignore
+cursorbind +listcmds +smartindent +wildmenu
+cursorshape +localmap +sound +windows
+dialog_con_gui +lua/dyn +spell +writebackup
+diff +menu +startuptime -xfontset
+digraphs +mksession +statusline -xim
+directx +modify_fname -sun_workshop +xpm_w32
-dnd +mouse +syntax -xterm_save
-ebcdic +mouseshape +tag_binary
+emacs_tags +multi_byte_ime/dyn -tag_old_static
system vimrc file: "$VIM\vimrc"
user vimrc file: "$HOME\_vimrc"
2nd user vimrc file: "$HOME\vimfiles\vimrc"
3rd user vimrc file: "$VIM\_vimrc"
user exrc file: "$HOME\_exrc"
2nd user exrc file: "$VIM\_exrc"
system gvimrc file: "$VIM\gvimrc"
user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$HOME\vimfiles\gvimrc"
3rd user gvimrc file: "$VIM\_gvimrc"
defaults file: "$VIMRUNTIME\defaults.vim"
system menu file: "$VIMRUNTIME\menu.vim"
Compilation: cl -c /W3 /nologo -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DFEAT_CSCOPE -DFEAT_TERMINAL
-DFEAT_SOUND -DFEAT_NETBEANS_INTG -DFEAT_JOB_CHANNEL -DFEAT_XPM_W32 -DWINVER=0x0501
-D_WIN32_WINNT=0x0501 /MP -DHAVE_STDINT_H /Ox /GL -DNDEBUG /arch:IA32 /Zl /MT -DFEAT_OLE
-DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_MSWIN -DFEAT_DIRECTX -DDYNAMIC_DIRECTX
-DFEAT_DIRECTX_COLOR_EMOJI -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL
-DDYNAMIC_TCL_DLL=\"tcl86t.dll\" -DDYNAMIC_TCL_VER=\"8.6\" -DFEAT_LUA -DDYNAMIC_LUA
-DDYNAMIC_LUA_DLL=\"lua53.dll\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"pyth
on27.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python36.dll\"
-DFEAT_MZSCHEME -I "E:\Racket\include" -DMZ_PRECISE_GC -DDYNAMIC_MZSCHEME
-DDYNAMIC_MZSCH_DLL=\"libracket3m_a36fs8.dll\" -DDYNAMIC_MZGC_DLL=\"libracket3m_a36fs8.dll\"
-DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"pe
rl524.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=24 -DDYNAMIC_RUBY_DLL=\"msvcrt-ruby2
40.dll\" -DFEAT_HUGE /Fd.\ObjGXOULYHTRZi386/ /Zi
Linking: link /nologo /opt:ref /LTCG:STATUS oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib
comdlg32.lib ole32.lib netapi32.lib uuid.lib /machine:i386 gdi32.lib version.lib winspool.lib comctl32.lib
advapi32.lib shell32.lib netapi32.lib /machine:i386 libcmt.lib oleaut32.lib user32.lib /nodefaultlib:lua53.lib
/STACK:8388608 /nodefaultlib:python27.lib /nodefaultlib:python36.lib "E:\ActiveTcl\lib\tclstub86.lib" winmm.lib
Error detected while processing function <SNR>2_install[1]..<SNR>2_update_impl[58]..<SNR>2_git_version_requirement[2]..<SNR>2_system:
line 8:
E484: Can't open file C:/Users/saikr/AppData/Local/Temp/VIo96D.tmp
Error detected while processing function <SNR>2_install[1]..<SNR>2_update_impl[58]..<SNR>2_git_version_requirement: line 2:
E171: Missing :endif
The same thing happened to me using Gvim on Windows 10.
I can add a workaround for cmd.exe shell to improve the out-of-box experience but the tmp batchfile strategy is unavoidable for other shells (ie. sh, powershell). Need https://github.com/junegunn/vim-plug/pull/937 to reduce the amount of git processes spawned by vim-plug.
vim-plug should use less batchfiles now but there could be encoding issues for those that use non-English codepages.
Error detected while processing function <SNR>2_install[1]..<SNR>2_update_impl[58]..<SNR>2_git_version_requirement[2]..<SNR>2_system: line 8: E484: Can't open file C:/Users/saikr/AppData/Local/Temp/VIo96D.tmp Error detected while processing function <SNR>2_install[1]..<SNR>2_update_impl[58]..<SNR>2_git_version_requirement: line 2: E171: Missing :endifThe same thing happened to me using Gvim on Windows 10.
I'm getting the same error when I run :PlugInstall or :PlugUpdate:
Error detected while processing function <SNR>18_install[1]..SNR>18_update_impl[58]..SNR>18_git_version_requirement[2]..<SNR>18_system:
line 24:
E484: Can't open file C:/Users/<username>/AppData/Local/Temp/VIo96D.tmp
Error detected while processing function <SNR>18_install[1]..<SNR>18_update_impl[61]..SNR>18_git_version_requirement:
line 2:
E171: Missing :endif
Error detected while processing function <SNR>18_install[1]..<SNR>18_update_impl:
line 61:
E171: Missing :endif
Similarly, :PlugUpgrade shows:
Error detected while processing function <SNR>18_upgrade[7]..<SNR>18_system:
line 24:
E484: Can't open file C:/Users/<username>/AppData/Local/Temp/VIo9CF5.tmp
Vim v8.2.1058 on Windows 10 using Windows Terminal, PowerShell, CMD.
I have encountered the same problem and I solved it by (1) comment out "set shellslash", as vim-plug does not compact with this option on windows; (2) open gvim with admin rights. not sure which one actually works.
hope this can help you~ ^_^
https://github.com/junegunn/vim-plug/commit/d2f8ca2dbc290dbad75356e59e3b0287c1b28972#diff-0467dc3d01e54437b08868e627565c40R180-R184
shellslash should be caught by vim-plug.
@TpstCoder I guess you set shellslash after plug#begin.
I had a similar problem. my .vimrc contains:
plug#end
...
if has("win32")
set shell=c:/apps/gitforwin/bin/bash.exe " use git for windows bash
set shellcmdflag=-c
set shellslash
set guioptions+=! " don't open cmd.exe-window on windows in case of :!
endif
managed to fix this by using:
" PlugUpdate
command! MyPlugUpdate :set shell=cmd.exe shellcmdflag=/c noshellslash guioptions-=! <bar> noau PlugUpdate
" PlugInstall
command! MyPlugInstall :set shell=cmd.exe shellcmdflag=/c noshellslash guioptions-=! <bar> noau PlugInstall
" PlugClean
command! MyPlugClean :set shell=cmd.exe shellcmdflag=/c noshellslash guioptions-=! <bar> noau PlugClean
vim-plug version: Branch Master at 2020 Sept. 22 VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 17 2020 22:10:57) MS-Windows 32-bit GUI version with OLE support Included patches: 1-1704
The solution from @KnoP-01 leaves the shell as cmd.exe after running any of the custom MyPlug commands. I tried saving off shell and restoring it before and after each command, but the restore happens too early since the standard Plug commands are asynchronous.
Instead I just wrapped the contents of the if block in a function and made another command to call that to manual restore the shell. If someone knows a way to wait on the Plug commands to finish we could have the shell restored automatically.
I experience the same on GVim 8.2 on Windows 10 and none of the solutions above worked for me.
E484: Can't open file C:\Users\Admin\AppData\Local\Temp\VIo9C56.tmp
Working off @KnoP-01's solution, all I did was put this at the bottom of my .vimrc, to make sure set shell=cmd.exe takes precedence:
" Nasty hacks
if has('win32')
" https://github.com/junegunn/vim-plug/issues/852#issuecomment-696431055
set shell=cmd.exe
endif
Works for both gvim and vim from the PowerShell.
Working off @KnoP-01's solution, all I did was put this at the bottom of my .vimrc, to make sure
set shell=cmd.exetakes precedence:" Nasty hacks if has('win32') " https://github.com/junegunn/vim-plug/issues/852#issuecomment-696431055 set shell=cmd.exe endifWorks for both gvim and vim from the PowerShell.
This hack works for me.