I use Neovim on ubuntu, for coding in Python. My init file is not too complicated and only requires installation of auto-pairs and coc.
After installing node, nvm and yarn, everything seems to work fine if I launch Neovim from the Linux Terminal, for example using "sudo nvim apythonfile.py". In this situation, I can edit the file normally, with auto completion working using coc-python.
The problem arises when I open a python file simply by double-clicking on it. As I set up Neovim as the default app to launch .py files, Neovim opens the file but this time also displays this error message:
Curent Node.js version v10.19.0 < 14.14.0
Please upgrade your .js
And of course, auto completion does not work here. This is a bit annoying, as I would like to be able to open a python file directly without having to go through the terminal everytime.
I tried to check node –version in the linux terminal, which gave me v14.14.0. So, I have no idea where this v10.19.0 comes from.
Can someone help me solve the problem ?
2
Answers
Remove Node.js completely from your system as described here:
How can I completely uninstall nodejs, npm and node in Ubuntu
And then reinstall Node.js as described here:
https://github.com/nodesource/distributions#installation-instructions
You can run
:checkhealth
and it should give you a more detailed description of what’s going wrong.I’d guess it works correctly because your terminal is setting the correct node version (in bashrc or zshrc etc.) and then you’re entering neovim. When you double-click a file to open it you circumvent the terminal and open neovim directly, which does not use the node version set by your terminal but by your system.
Try running
sudo update-alternatives -a
and you can customize which executable to use for every command. You probably have two node versions installed.