Result from CocInfo
## versions
vim version: NVIM v0.3.4
node version: v8.9.0
coc.nvim version: 0.0.53
term: xterm
platform: linux
## Error messages
Update error: exited with 127
Describe the bug
I am unable to install/update extensions without having yarn installed. I don't use yarn anywhere.
It would be great if coc would detect that I don't have yarn and just use npm instead.
To Reproduce
Steps to reproduce the behavior:
:CocUpdateScreenshots

It's not simple since coc also run yarn command internal, I don't have time for it, pull request is welcome.
@chemzqm :+1:
Should we really want to add complexity to support this? IMHO it would be better to support one package manager (in this case Yarn), there are already so many running parts involved.
Just my 2 cents, feel free to ignore ;)
@jpoppe ideally - no, but npm should have been used in the first place as it comes by default with nodejs. At this point yarn is not significantly better than npm, though it may have been at the time of creating this plugin.
A good solution would abstract away package installation so that these changes are trivial to make.
I know npm is getting better, but old node bundles with old npm, and I don't want to deal with npm issues.
I have a different questions, but still related: is it possible to install these extensions manually without resorting to :CocInstall?
I have a dotfiles repo that uses git submodules and would like to link the related modules without having to manually do :CocInstall for certain plugins every time I clone my dotfiles. I'd rather do yarn install from my main dotfiles install script than from vim. Thanks!
@jeremija you can write shell script like:
# Install extensions
mkdir -p ~/.config/coc/extensions
cd ~/.config/coc/extensions
if [ ! -f package.json ]
then
echo '{"dependencies":{}}'> package.json
fi
# Change arguments to extensions you need
yarn add coc-json coc-snippets
Or checkout :h coc#add_extension() for vim script.
@chemzqm Thanks! I think this is exactly what I was looking for!
@jeremija This is the solution I use for the same problem. Set g:coc_global_extensions variable and coc installs them if they are not already installed upon startup of vim.
let g:coc_global_extensions = [
\ 'coc-css',
\ 'coc-highlight',
\ 'coc-html',
\ 'coc-json',
\ 'coc-snippets',
\ 'coc-stylelint',
\ 'coc-tag',
\ 'coc-tsserver'
\ ]
Now, you can use vim's plugin manager for manage coc extensions, checkout https://github.com/neoclide/coc.nvim/wiki/Using-coc-extensions#use-vims-plugin-manager-for-coc-extension.
When use vim's plugin manager, you can use npm or yarn to install dependencies.
:+1: thanks for all the work you do @chemzqm
I must be doing something wrong but this recent feauture is not working for me using npm:
Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}}
Plug 'neoclide/coc-tsserver', {'do': 'npm i'} " ALSO TRIED WITH 'npm ci'
Plug 'neoclide/coc-eslint', {'do': 'npm i'} " ALSO TRIED WITH 'npm ci'
Plug 'neoclide/coc-json', {'do': 'npm i'} " ALSO TRIED WITH 'npm ci'
Plug 'neoclide/coc-prettier', {'do': 'npm i'} " ALSO TRIED WITH 'npm ci'
Plug 'neoclide/coc-css', {'do': 'npm i'} " ALSO TRIED WITH 'npm ci'
Then I've run: :PlugInstall but got this back:
x Post-update hook for coc-css ... Exit status: 1
x Post-update hook for coc-eslint ... Exit status: 1
x Post-update hook for coc-prettier ... Exit status: 1
x Post-update hook for coc-tsserver ... Exit status: 1
x Post-update hook for coc-json ... Exit status: 1
There's an error message but it only stays on the screen for a flash then VimPlug buffer overrides it.
Anyone facing this issue as well? I don't use yarn and wanted to refrain to installing it just to manage these dependencies...
If I replace npm i with yarn install --frozen-lockfile it worked partially: for some reason coc-css continues to err out with: x Post-update hook for coc-css ... Exit status: 1.
Any clue why?
Using the plug install method, I was able to make everything work writing it like this:
Plug 'neoclide/coc-tsserver', {'do': 'npm i package.json && npm i'}
For some reason, the npm i command would not install everything properly, so I force the install of everything with npm i package.json and then run npm i again to make sure all the build process run as expected.
Tried your config above it with PlugInstall! but it failed:
- Post-update hook for coc-css ... OK
x Post-update hook for coc-eslint ... Exit status: 1
x Post-update hook for coc-tsserver ... Exit status: 1
- Post-update hook for coc.nvim ... OK
- Post-update hook for coc-snippets ... OK
- Post-update hook for coc-prettier ... OK
- Post-update hook for coc-json ... OK
I saw some weird lines like the following:
node_modules/coc.nvim/lib/provider/index.d.ts(1,29): error TS2305: Module '"../../../../../../../../../../../../Users/marelo/.local/share/nvim/site/plugged/coc-tsserver/node_modules/vscode-languageserver-protocol/lib/main"' has no exported...
The ones that failed were working before. Then i tried:
rm -rf ~/.local/share/nvim/site/plugged/coc-* and PlugInstall! again.This time only one failed:
- Post-update hook for coc-css ... OK
- Post-update hook for coc-eslint ... OK
x Post-update hook for coc-tsserver ... Exit status: 1
- Post-update hook for coc.nvim ... OK
- Post-update hook for coc-snippets ... OK
- Post-update hook for coc-prettier ... OK
- Post-update hook for coc-json ... OK
Then this time I changed your config to leave the && npm i in the end (so only npm i package.json). Did the rm -rf part again, PlugInstall! and it everything was OK!!
But, when i restarted nvim i had this error on the status bar:

馃槩
I've encountered this issue as well. I was running yarn 1.22.4 and node 14.9.0. After updating to yarn 1.22.5 and node 14.15.1, as well as running yarn cache clean, I was able to update coc.
Most helpful comment
@jpoppe ideally - no, but npm should have been used in the first place as it comes by default with nodejs. At this point yarn is not significantly better than npm, though it may have been at the time of creating this plugin.
A good solution would abstract away package installation so that these changes are trivial to make.