coc-tsserver: Can not find tsserver error on 1.3.8

It appears that the 1.3.8 release has broken coc-tsserver for me: The output of :CocInfo on 1.3.8:

## versions

vim version: NVIM v0.3.5
node version: v12.2.0
coc.nvim version: 0.0.71-4ee27ce232
term: screen-256color
platform: linux

## Messages
[coc.nvim] Bundled typescript module not found
[coc.nvim] Can not find tsserver, run ':CocInstall coc-tsserver' to fix it!

This happens when I open a JS file using nvim test.js I have tried to do :CocInstall coc-tsserver to no avail. Using vim-plug also does not solve the problem:

Plug 'neoclide/coc-tsserver', {'tag': '1.3.8', 'do': 'yarn install --frozen-lockfile'} 

On downgrade to 1.3.7 using vim-plug the error does not appear and the extension works flawlessly:

Plug 'neoclide/coc-tsserver', {'tag': '1.3.7', 'do': 'yarn install --frozen-lockfile'} 

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (5 by maintainers)

Most upvoted comments

hi @steelx , I had same error (with coc-sh), it was the installer Uninstall node from snap sudo snap remove node and install it through apt-get (or .tar,… official link) sudo apt-get install nodejs

With snap and :CocInstall {whatever} the coc.nvim installer reports: Using npm from: /snap/bin/npm While with apt-get and :CocInstall {whatever}: Using npm from: /usr/local/bin/yarnpkg Or if apt-get installed npm sudo apt install npm then it shows Using npm from: /usr/bin/npm

Fixed on 1.3.9

I encounter the same problem, here is the log

0 info it worked if it ends with ok
1 verbose cli [ '/Users/joey/.nvm/versions/node/v10.17.0/bin/node',
1 verbose cli   '/Users/joey/.nvm/versions/node/v10.17.0/bin/npm',
1 verbose cli   'install',
1 verbose cli   'typescript',
1 verbose cli   '--verbose' ]
2 info using npm@6.11.3
3 info using node@v10.17.0
4 verbose npm-session 90fe9de7710d8144
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/typescript 1084ms (from cache)
8 silly fetchPackageMetaData error for typescript@3.7.3 Unexpected end of JSON input while parsing near '...del":"latest","gulp":'
9 timing stage:rollbackFailedOptional Completed in 1ms
10 timing stage:runTopLevelLifecycles Completed in 1134ms
11 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...del":"latest","gulp":'
11 verbose stack     at JSON.parse (<anonymous>)
11 verbose stack     at parseJson (/Users/joey/.nvm/versions/node/v10.17.0/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
11 verbose stack     at consumeBody.call.then.buffer (/Users/joey/.nvm/versions/node/v10.17.0/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50)
11 verbose stack     at process._tickCallback (internal/process/next_tick.js:68:7)
12 verbose cwd /Users/joey/.config/coc/extensions/node_modules/coc-tsserver
13 verbose Darwin 19.0.0
14 verbose argv "/Users/joey/.nvm/versions/node/v10.17.0/bin/node" "/Users/joey/.nvm/versions/node/v10.17.0/bin/npm" "install" "typescript" "--verbose"
15 verbose node v10.17.0
16 verbose npm  v6.11.3
17 error Unexpected end of JSON input while parsing near '...del":"latest","gulp":'
18 verbose exit [ 1, true ]

Log shows it got errors when installing typescript, and after I googled some pages, I fixed the problem by cleaned the npm cache. If you guys encounter same problem maybe have a try:

npm cache clean --force

Cleaning cache fixed the issue

I encounter the same problem, here is the log

0 info it worked if it ends with ok
1 verbose cli [ '/Users/joey/.nvm/versions/node/v10.17.0/bin/node',
1 verbose cli   '/Users/joey/.nvm/versions/node/v10.17.0/bin/npm',
1 verbose cli   'install',
1 verbose cli   'typescript',
1 verbose cli   '--verbose' ]
2 info using npm@6.11.3
3 info using node@v10.17.0
4 verbose npm-session 90fe9de7710d8144
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/typescript 1084ms (from cache)
8 silly fetchPackageMetaData error for typescript@3.7.3 Unexpected end of JSON input while parsing near '...del":"latest","gulp":'
9 timing stage:rollbackFailedOptional Completed in 1ms
10 timing stage:runTopLevelLifecycles Completed in 1134ms
11 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...del":"latest","gulp":'
11 verbose stack     at JSON.parse (<anonymous>)
11 verbose stack     at parseJson (/Users/joey/.nvm/versions/node/v10.17.0/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
11 verbose stack     at consumeBody.call.then.buffer (/Users/joey/.nvm/versions/node/v10.17.0/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50)
11 verbose stack     at process._tickCallback (internal/process/next_tick.js:68:7)
12 verbose cwd /Users/joey/.config/coc/extensions/node_modules/coc-tsserver
13 verbose Darwin 19.0.0
14 verbose argv "/Users/joey/.nvm/versions/node/v10.17.0/bin/node" "/Users/joey/.nvm/versions/node/v10.17.0/bin/npm" "install" "typescript" "--verbose"
15 verbose node v10.17.0
16 verbose npm  v6.11.3
17 error Unexpected end of JSON input while parsing near '...del":"latest","gulp":'
18 verbose exit [ 1, true ]

Log shows it got errors when installing typescript, and after I googled some pages, I fixed the problem by cleaned the npm cache. If you guys encounter same problem maybe have a try:

npm cache clean --force