neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.33k stars 956 forks source link

CocInstall is failing on all installs #4491

Closed eloraiby closed 1 year ago

eloraiby commented 1 year ago

Result from CocInfo

## versions                                                                                              

vim version: NVIM v0.6.1                                                                                 
node version: v18.13.0                                                                                   
coc.nvim version: 0.0.82-b7375d5 2023-01-30 05:09:03 +0800                                               
coc.nvim directory: /home/redacted/.local/share/nvim/plugged/coc.nvim                                        
term: xterm-256color                                                                                     
platform: linux                                                                                          

## Log of coc.nvim                                                                                       

2023-01-31T20:51:02.899 INFO (pid:168090) [plugin] - coc.nvim initialized with node: v18.13.0 after 70   
2023-01-31T20:51:43.537 INFO (pid:168090) [attach] - receive notification: installExtensions [ 'coc-json'
 ]                                                                                                       
2023-01-31T20:51:44.147 INFO (pid:168090) [extension-installer] - Fetched info of coc-json {             
  'dist.tarball': 'https://registry.npmjs.org/coc-json/-/coc-json-1.8.0.tgz',                            
  'engines.coc': '>= 0.0.80',                                                                            
  version: '1.8.0',                                                                                      
  name: 'coc-json'                                                                                       
}                                                                                                        
2023-01-31T20:51:44.157 ERROR (pid:168090) [extensions-index] - Error on install coc-json Error: Invalid 
dest path: .config/coc/extensions/node_modules/coc-json-b8365cae-5680-479e-91dd-5fd26af4ee8d             
    at download (/home/redacted/.local/share/nvim/plugged/coc.nvim/build/index.js:58680:11)                  
    at Installer.download (/home/redacted/.local/share/nvim/plugged/coc.nvim/build/index.js:59066:22)        
    at Installer.doInstall (/home/redacted/.local/share/nvim/plugged/coc.nvim/build/index.js:59044:22)       
    at Installer.install (/home/redacted/.local/share/nvim/plugged/coc.nvim/build/index.js:58949:34)         
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)                        
    at async fn (/home/redacted/.local/share/nvim/plugged/coc.nvim/build/index.js:72884:26)

Describe the bug

All installs are following the same error message: tried with both stable and build using yarn

Reproduce the bug

We will close your issue when you don't provide minimal vimrc and we can't reproduce it

call plug#begin()
Plug 'ncm2/ncm2'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
" Use release branch (recommend)
" Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Or build from source code by using yarn: https://yarnpkg.com
Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'}
call plug#end()

Screenshots (optional)

If applicable, add screenshots to help explain your problem.

fannheyward commented 1 year ago

I can't reproduce this issue.

vim version: NVIM v0.6.1

I don't know this related or not, try upgrade your nvim and try again.

eloraiby commented 1 year ago

what version do you recommend? according to the doc, it should work:

Neovim >= 0.4.0.

fannheyward commented 1 year ago

Yes, coc should work on nvim 0.4.0+. I'm using 0.8.2. I'll try with 0.6.

eloraiby commented 1 year ago

Thanks, tried version 0.8.2, same issue:

## versions

vim version: NVIM v0.8.2
node version: v18.13.0
coc.nvim version: 0.0.82-b7375d5 2023-01-30 05:09:03 +0800
coc.nvim directory: /home/redacted/.local/share/nvim/plugged/coc.nvim
term: xterm-256color
platform: linux

## Log of coc.nvim

2023-01-31T21:13:52.682 INFO (pid:170497) [plugin] - coc.nvim initialized with node: v18.13.0 after 76
2023-01-31T21:14:12.409 INFO (pid:170497) [attach] - receive notification: installExtensions [ 'coc-json' ]
2023-01-31T21:14:12.978 INFO (pid:170497) [extension-installer] - Fetched info of coc-json {
  'dist.tarball': 'https://registry.npmjs.org/coc-json/-/coc-json-1.8.0.tgz',
  'engines.coc': '>= 0.0.80',
  version: '1.8.0',
  name: 'coc-json'
}
2023-01-31T21:14:12.988 ERROR (pid:170497) [extensions-index] - Error on install coc-json Error: Invalid dest path: .config/coc/extensions/node_modules/coc-json-5a9626df-6167-4d59-81af-b624cebfdb51
    at download (/home/redacted/.local/share/nvim/plugged/coc.nvim/build/index.js:58680:11)
    at Installer.download (/home/redacted/.local/share/nvim/plugged/coc.nvim/build/index.js:59066:22)
    at Installer.doInstall (/home/redacted/.local/share/nvim/plugged/coc.nvim/build/index.js:59044:22)
    at Installer.install (/home/redacted/.local/share/nvim/plugged/coc.nvim/build/index.js:58949:34)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async fn (/home/redacted/.local/share/nvim/plugged/coc.nvim/build/index.js:72884:26)
2023-01-31T21:14:25.306 INFO (pid:170497) [attach] - receive notification: showInfo []

I know it's more work, but you might be able to reproduce it on a clean ubuntu 22.04 with neovim, latest nodejs and npm (downloaded)

fannheyward commented 1 year ago

Tested with nvim 0.6.1, on macOS, still can't reproduce.

2023-02-01T10:18:26.395 INFO (pid:2080) [extension-installer] - Fetched info of coc-json {
  'dist.tarball': 'https://registry.npmjs.org/coc-json/-/coc-json-1.8.0.tgz',
  'engines.coc': '>= 0.0.80',
  version: '1.8.0',
  name: 'coc-json'
}
2023-02-01T10:18:26.543 INFO (pid:2080) [model-download] - Download completed: URL {
  href: 'https://registry.npmjs.org/coc-json/-/coc-json-1.8.0.tgz',
  origin: 'https://registry.npmjs.org',
  protocol: 'https:',
  username: '',
  password: '',
  host: 'registry.npmjs.org',
  hostname: 'registry.npmjs.org',
  port: '',
  pathname: '/coc-json/-/coc-json-1.8.0.tgz',
  search: '',
  searchParams: URLSearchParams {},
  hash: ''
}
2023-02-01T10:18:26.545 INFO (pid:2080) [model-download] - Downloaded https://registry.npmjs.org/coc-json/-/coc-json-1.8.0.tgz => /Users/fannheyward/.config/coc/extensions/node_modules/coc-json-3df0221b-ffb3-47d5-a827-9993370340e8
eloraiby commented 1 year ago

anything special to env variables you use?

fannheyward commented 1 year ago

Debuging on this.

fannheyward commented 1 year ago

Do you have set g:coc_data_home?

eloraiby commented 1 year ago

Found it! Ubuntu or rather Kubuntu 22.04 doesn't add XDG_CONFIG_HOME env variable, we need to set it manuall to ~/.config

eloraiby commented 1 year ago

Thanks @fannheyward , closing it!

fannheyward commented 1 year ago

What's the output of :echo exists('$XDG_CONFIG_HOME'), :echo $XDG_CONFIG_HOME and :echo len($XDG_CONFIG_HOME)?

Testing before manually set.

eloraiby commented 1 year ago

they were set to .config , changed to /home/redacted/.config and now they work

fannheyward commented 1 year ago

Yes, after you set it to .config coc works as expected.

I want to debug the checking of $XDG_CONFIG_HOME. coc check $XDG_CONFIG_HOME exists but still failed on your env. Looks like $XDG_CONFIG_HOME in your env is exists but set to empty, so please help me to debug this.

  1. don't set it to .config 2.:echo exists('$XDG_CONFIG_HOME'), :echo $XDG_CONFIG_HOME and :echo len($XDG_CONFIG_HOME)
eloraiby commented 1 year ago

0, nothing, `0' respectively

fannheyward commented 1 year ago

they were set to .config , changed to /home/redacted/.config and now they work

Got the problem.

if exists('$XDG_CONFIG_HOME')
    let dir = resolve($XDG_CONFIG_HOME."/coc")

$XDG_CONFIG_HOME is set to .config, but incorrect, can't resolve to correct dir.

eloraiby commented 1 year ago

yep