Coc.nvim: New install results in "[coc.nvim] Can't find npm or yarn in your $PATH"

Created on 28 Apr 2020  路  4Comments  路  Source: neoclide/coc.nvim

Result from CocInfo

  1 ## versions                                                                                                                                       
  2 
  3 vim version: VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 27 2020 08:42:31)
  4 node version: v10.15.2
  5 coc.nvim version: 0.0.78-9febe802b3
  6 term: dumb
  7 platform: linux
  8 

Describe the bug

I did an install following the instructions, using Plug: Plug 'neoclide/coc.nvim', {'branch': 'release'}. Immediately after PlugInstall, I got this warning in my messages. I also get it every time I start vim, and when I try to use CocInstall.

Reproduce the bug

vimrc:

set nocompatible
filetype plugin indent on
syntax on
set hidden
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()

Screenshots (optional)

demonstration here: https://asciinema.org/a/URaUE14Cch7Hg6Ev4choQGl1C

Most helpful comment

@JDtheGeek setting the following key in my coc-settings.json worked:

{
    "npm.binPath": "~/.nvm/versions/node/v12.9.1/bin/npm",
}

See :h coc-config-npm or coc.text.

All 4 comments

setting "coc.preferences.extensionUpdateCheck": "never" in coc-settings.json gets rid of the error on startup.

Updating extensions needs npm/yarn, and some extensions installation also need npm/yarn. I recommend to install npm/yarn, if you really don't like them, you may fail to do :CocInstall on some extensions.

Same issue, but have node/npm installed, possibly due to being installed via nvm (node version manager)?

Added let g:coc_node_path = '/home/jd/.nvm/versions/node/v11.15.0/bin/node' to the init.vim which got rid of my initial issue with the node path but now I'm getting the same error as OP where it can't find npm or yarn.

which npm returns /home/jd/.nvm/versions/node/v11.15.0/bin/npm

@JDtheGeek setting the following key in my coc-settings.json worked:

{
    "npm.binPath": "~/.nvm/versions/node/v12.9.1/bin/npm",
}

See :h coc-config-npm or coc.text.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FrankLA0203 picture FrankLA0203  路  3Comments

czepluch picture czepluch  路  3Comments

svenstaro picture svenstaro  路  4Comments

MaskRay picture MaskRay  路  3Comments

skylite21 picture skylite21  路  3Comments