Skip to content

Setting g:node_host_prog in init.vim generates an error. #15308

@gilbertfrancois

Description

@gilbertfrancois

Neovim Version

v0.5.0

Operating system/version:

Ubuntu 18.04

Terminal name/version:

terminal

TERM environment variable

xterm-256color

Installation

nvim.appimage from the release page

Steps to reproduce

Description

I work on different servers and don't want to mess with system wide installed Python and NodeJS distributions. Moreover, the NodeJS distribution, shipped with e.g. Ubuntu 18.04 is too old. That is why I have a NodeJS distribution and custom Python environment in the ${HOME}/.local/share/nvim/lib folder, for Neovim only. Then I specify in init.vim the node host program and Python host program with the options:

let g:python3_host_prog = join([$HOME, "/.local/share/nvim/lib/python/bin/python3"], "")
let g:node_host_prog = join([$HOME, "/.local/share/nvim/lib/node/bin/node"], "")

For python, this works excellent. However, for Node, it does not work. Node only works well if the node binary is in the path and the option g:node_host_prog is not set.

Workaround

Comment out the g:node_host_prog setting in init.vim and run nvim with:

PATH=${HOME}/.local/share/nvim/lib/node/bin:${PATH} nvim

PS: nvim 0.5.0 on macOS has the same problem.

Vim

No response

Expected behavior

Run :checkhealth in nvim with the node binary of choice in the path and not set the node_host_prog:

...
## Python 3 provider (optional)
   - INFO: pyenv: Path: /home/ubuntu/.pyenv/libexec/pyenv
   - INFO: pyenv: Root: /home/ubuntu/.pyenv
   - INFO: Using: g:python3_host_prog = "/home/ubuntu/.local/share/nvim/lib/python/bin/python3"
   - INFO: Executable: /home/ubuntu/.local/share/nvim/lib/python/bin/python3
   - INFO: Python version: 3.7.7
   - INFO: pynvim version: 0.4.3
   - OK: Latest pynvim is installed.
 
 ## Node.js provider (optional)
   - INFO: Node.js: v14.16.1
   - INFO: Nvim node.js host: /home/ubuntu/.local/share/nvim/lib/node-v14.16.1-linux-x64/lib/node_modules/neovim/bin/cli.js
   - OK: Latest "neovim" npm/yarn package is installed: 4.10.0
...

Actual behavior

Run :checkhealth in nvim with g:node_host_prog and g:python3_host_prog set to custom locations. Note that for NodeJS, nvim finds /usr/bin/node (v8.10.0) installed on the system, instead of the one set with g:node_host_prog (v14.16.1) option.

...
## Python 3 provider (optional)
   - INFO: pyenv: Path: /home/ubuntu/.pyenv/libexec/pyenv
   - INFO: pyenv: Root: /home/ubuntu/.pyenv
   - INFO: Using: g:python3_host_prog = "/home/ubuntu/.local/share/nvim/lib/python/bin/python3"
   - INFO: Executable: /home/ubuntu/.local/share/nvim/lib/python/bin/python3
   - INFO: Python version: 3.7.7
   - INFO: pynvim version: 0.4.3
   - OK: Latest pynvim is installed.

## Node.js provider (optional)
   - INFO: Node.js: v8.10.0
   - INFO: Nvim node.js host: /home/ubuntu/.local/share/nvim/lib/node/bin/node --prefix=/home/ubuntu/.local/share/nvim/lib/node
   - ERROR: Command error (job=10, exit code 1): `node '/home/ubuntu/.local/share/nvim/lib/node/bin/node --prefix=/home/ubuntu/.local/share/nvim/lib/node' --version` (in '/home/ubuntu/.dotfiles/nvim')
     stderr: module.js:549    throw err;    ^Error: Cannot find module '/home/ubuntu/.local/share/nvim/lib/node/bin/node --prefix=/home/ubuntu/.local/share/nvim/lib/node'    at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:188:16) at bootstrap_node.js:609:3 in/node --prefix=/home/ubuntu/.local/share/
   - ERROR: Failed to run: ['node', '/home/ubuntu/.local/share/nvim/lib/node/bin/node --prefix=/home/ubuntu/.local/share/nvim/lib/node', '--version']
     - ADVICE:
       - Report this issue with the output of:
       - ['node', '/home/ubuntu/.local/share/nvim/lib/node/bin/node --prefix=/home/ubuntu/.local/share/nvim/lib/node', '--version']
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed:invalidIssues that are closed as "invalid"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions