coc-metals
coc-metals copied to clipboard
I recently Dockerized my workspace for portability
I ran into a few issues and I wanted to share them with you to see if I was the only one having these problems.
- When I installed the
coc-metals
plugin via vimPlug it did not get loaded at all I had to useCocInstall coc-metals
to get the plugin working -
metals.javaHome:/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home
on my mac but on other distributions it's in different places. Maybe I had this set for older versions and it's no longer needed? I have a JAVA_HOME env var in my bashrc but maybe it's not being pulled in? - I think there was some other issues but I can't remember off the top of my head.
I'd be happy to share my dockerfile if anyone is interested.
Thanks for the feedback @vito-c.
When I installed the coc-metals plugin via vimPlug it did not get loaded at all I had to use CocInstall coc-metals to get the plugin working
Did you get any type of errors at all from vimPlug when you tried to do the install? Could you possible share you Dockerfils so I can see the env and such to see if I can replicate and figure out what's going on?
metals.javaHome:/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home on my mac but on other distributions it's in different places. Maybe I had this set for older versions and it's no longer needed? I have a JAVA_HOME env var in my bashrc but maybe it's not being pulled in?
As long as you actually have JAVA_HOME
set, seeing metals.javaHome
shouldn't really be necessary.
ok I will play around with # 2 and then paste out my dockerfile here to this ticket. Thanks a lot fo the fast responses! :)
FROM archlinux
ARG OPENJDK_TAG=8u232
RUN pacman -Sy --noconfirm jdk8-openjdk
RUN pacman -Sy --noconfirm git ripgrep neovim jq sbt
RUN pacman -Sy --noconfirm kubectl go fzf bat bash-completion
RUN pacman -Sy --noconfirm yarn fd ctags
RUN pacman -Sy --noconfirm python python-pip
RUN pacman -Sy --noconfirm postgresql
RUN pacman -Sc --noconfirm
RUN mkdir -p ~/code/configs
RUN mkdir -p ~/.config
RUN python3 -m pip install --upgrade pynvim
ADD https://api.github.com/repos/vito-c/pirate-setup/git/refs/heads/master version.json
RUN git clone -b master https://github.com/vito-c/pirate-setup ~/code/configs/pirate-setup
ADD https://api.github.com/repos/vito-c/pirate-vim/git/refs/heads/master version.json
RUN git clone -b master https://github.com/vito-c/pirate-vim ~/code/configs/pirate-vim
RUN sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
RUN ln -snf ~/code/configs/pirate-setup/bash_profile ~/.bash_profile
RUN ln -snf ~/code/configs/pirate-setup/bashrc ~/.bashrc
RUN ln -snf ~/code/configs/pirate-setup/inputrc ~/.inputrc
RUN ln -snf ~/code/configs/pirate-setup/jqrc ~/.jqrc
RUN ln -snf ~/code/configs/pirate-setup/octaverc ~/.octaverc
RUN ln -snf ~/code/configs/pirate-setup/git_template ~/.git_template
RUN ln -snf ~/code/configs/pirate-setup/gitconfig ~/.gitconfig
RUN ln -snf ~/code/configs/pirate-vim/ ~/.vim
RUN ln -snf ~/code/configs/pirate-vim ~/.config/nvim
RUN mkdir -p ~/code/configs/pirate-vim/bundle
ENV HOSTNAME=dorker
RUN nvim -u ~/code/configs/pirate-vim/rc/vimrc-plugins +PlugInstall +qall || true
RUN cd ~/code/configs/pirate-vim/bundle/coc.nvim && yarn install --frozen-lockfile && mkdir -p ~/.config/coc
# RUN nvim +call coc#util#install() > /dev/null
# vim: filetype=dockerfile
Here is the docker file :)
Thanks @vito-c although I was hoping for something I could just quickly run locally without setting anything 😬. From looking at everything though, I wonder if the issue is simply installing on Arch. I don't test against Arch at all, but just Ubuntu. I'll try to go down that route first and see if I can mimic the issue there.
@ckipp01 I updated the dockerfile so that the arguments are gone. You don't really need them. You should be able to run this locally really quickly just copy the above put it into a Dockerfile then docker build . -t archtest
Then docker run -it archtest
Huh, so it looks like even just going to directory and doing a yarn
command fails:
🐳 18:23:16 🏃 0 ~/.vim/bundle/coc-metals 🔀 master
$ yarn
yarn install v1.22.10
[1/5] Validating package.json...
warning [email protected]: The engine "coc" appears to be invalid.
[2/5] Resolving packages...
[3/5] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
[5/5] Building fresh packages...
[1/3] ⠂ core-js
[2/3] ⠂ deasync
error /root/code/configs/pirate-vim/bundle/coc-metals/node_modules/deasync: Command failed.
Exit code: 1
Command: node ./build.js
Arguments:
Directory: /root/code/configs/pirate-vim/bundle/coc-metals/node_modules/deasync
Output:
node:events:304
throw er; // Unhandled 'error' event
^
Error: spawn node-gyp ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:269:19)
at onErrorNT (node:internal/child_process:465:16)
at processTicksAndRejections (node:internal/process/task_queues:80:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:275:12)
at onErrorNT (node:internal/child_process:465:16)
at processTicksAndRejections (node:internal/process/task_queues:80:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn node-gyp',
path: 'node-gyp',
spawnargs: [ 'rebuild' ]
It seems to be that deasync
is the culprit. There are quite a few examples of this error when you search around. This is coming because of my dependency on parcel-bundler.
For example, this seems to point at some missing python libs, but it also mentions an old version of Node. However, I see you're on 15. I actually don't test building against 15, so I just added it into CI to see. I'll keep trying to figure this out, but figured I'd share that I can reproduce it.
Another update for you on the zombie processes... sometimes metal sticks around and I have to kill node to get them to go away... the workflow for this is
ssh to archlinux box nvim some files do some work exit vim exit ssh then logon to the box again and there are some java processes sticking around. I run bloop exit and they still zombie around... then I do ps aux | grep node and kill -9 them then kill the java processes and they go away.
I'm actually able to install coc-metals
but I have to do it through coc
it doesn't come down with vim-plug
I experienced the same issue with node 17 on arch with vim-plug, and was able to resolve it by installing npm via pacman. I think the important part is that this brings in node-gyp globally so it doesn't need to try to install it with the wrong python version in the plugin. I also happen to have installed python2 while trying to debug this, and that might have played a part, but I doubt it.