Open stefanpenner opened 3 years ago
@stefanpenner which version of Volta are you using? Our recent 0.9.x releases should have (a) stopped discouraging use of npm i -g
or yarn global add
and (b) made this work!
@chriskrycho The changes in 0.9.x still didn't quite get this working. neovim
itself isn't launched by Volta, so it doesn't pick up the NODE_PATH
that makes the neovim
package available with require
. It looks (given the above-linked issue) like neovim
looks in a couple of specific locations for the Node package, and Volta's custom package handling breaks those assumptions.
Ahhhh, that would do it; I misunderstood the dynamics with neovim
specifically. Thanks for clarifying, @charlespierce!
@stefanpenner - You have to specify node path in neovim config (init.vim
). Please add let g:node_host_prog = system('volta which neovim-node-host | tr -d "\n"')
to your neovim config and try again.
@mainendra that is a better workaround than the one I have listed, thank you.
That being said it would be great to make this more seamless.
In the meantime, I've changed my work-around to add the following to my init.vim
based on @mainendra's suggestion:
if executable('volta')
let g:node_host_prog = trim(system("volta which neovim-node-host"))
endif
I think we can convert this to enhancement story.
Thanks for your solutions. For me they were not 100% clear, so if anyone had the same problem. It worked with me via this:
local g = vim.g
g["node_host_prog"] = vim.call("system", 'volta which neovim-node-host | tr -d "\n"')
problem
neovim cannot discover node modules installed globally by volta
investigation
nvim +checkhealth
yields:
Given that when using volta,
npm i -g
andvolta global add
are discouraged, i run:volta install neovim
Which still has
nvim +checkhealth
yielding:Investigating further, neovim's algorithm essentially looks each of the following locations:
npm --loglevel silent root -g
yarn global dir
(for non unix)'$HOME/.config/yarn/global/'
(for unix)Likely ideal solution
Add volta support to neovim? corresponding neovim issue
Workaround:
The following has
volta
behave as if it wereyarn
, which appears to address the issue in question.yields a functional node.js provider for neovim.