bash-language-server icon indicating copy to clipboard operation
bash-language-server copied to clipboard

client 2 quit with exit code 1 and signal 0 bash-language-server

Open dongdongbh opened this issue 2 years ago • 4 comments

I work with NVIM 0.7 on Ubuntu, using lsp-config and bashls. I got this error after opening a bash file. I checked the lsp log, and it shows following errors

.../vim/lsp/rpc.lua:420	"rpc"	"bash-language-server"	"stderr"	

"/home/user/.local/share/nvim/lsp_servers/bashls/node_modules/bash-language-server/node_modules/vscode-jsonrpc/lib/common/linkedMap.js:40\n        
return this._head?.value;\n                         
 ^\n\nSyntaxError: Unexpected token .\n    
at Module._compile (internal/modules/cjs/loader.js:718:23)\n    
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)\n    
at Module.load (internal/modules/cjs/loader.js:641:32)\n    
at Function.Module._load (internal/modules/cjs/loader.js:556:12)\n    
at Module.require (internal/modules/cjs/loader.js:681:19)\n    
at require (internal/modules/cjs/helpers.js:16:16)\n    
at Object.<anonymous> (/home/dd/.local/share/nvim/lsp_servers/bashls/node_modules/bash-language-server/node_modules/vscode-jsonrpc/lib/common/api.js:37:21)\n    
at Module._compile (internal/modules/cjs/loader.js:774:30)\n   
 at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)\n   
 at Module.load (internal/modules/cjs/loader.js:641:32)\n"

I tried #339 solution, but it still not work

dongdongbh avatar May 30 '22 05:05 dongdongbh

Just had same issue on Ubuntu 22.04. I'm not practical with nodejs but it should mean that some token has been added in next version of nodejs (used by linkedMap.js). If you installed nodejs through apt package manager you should have version 12.22.9 and it doesn't work. Maybe there's a cleaner way but I solved with these steps, but be sure to have npm already installed:

sudo npm install -g n
sudo n stable

Once n command is done, it should tell you where it installed the new version of nodejs. Try following the output instructions. If they do not work and node --version still shows 12.22.9 you could find the old executable(s) using whereis node and delete them. Beware, I'm not sure this can't break something. I have not had time to test what's the minimum version required but maybe README.md should be updated.

I feel it a bit sketchy but it worked for me. Maybe someone knows a cleaner way to solve the problem.

MateCheck-rar avatar Jun 03 '22 13:06 MateCheck-rar

Using an older node version did the trick (neovim + lspconfig + brew example):

local brew_prefix = vim.fn.systemlist("brew --prefix")[1]
local bashls_script_name = 'bash-language-server'
local bashls_script_path = vim.fn.systemlist('which ' .. bashls_script_name)[1]
local bashls_cmd = { brew_prefix .. "/opt/node@16/bin/node", bashls_script_path, 'start' }
require('lspconfig')['bashls'].setup {
  capabilities = capabilities,
  on_attach = on_attach,
  cmd = bashls_cmd,
}

someone-stole-my-name avatar Jun 27 '22 07:06 someone-stole-my-name

I am having the same issue.

node --version -> v10.19.0

:LspLog [ERROR][2022-07-22 11:02:05] .../vim/lsp/rpc.lua:420 "rpc" "bash-language-server" "stderr" "/home/imobard/.local/share/nvim/lsp_servers/bashls/node_modules/bash-language-server/node_modules/vscode-jsonrpc/lib/common/linkedMap.js:40\n return this._head?.value;\n ^\n\nSyntaxError: Unexpected token .\n at Module._compile (internal/modules/cjs/loader.js:723:23)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)\n at Module.load (internal/modules/cjs/loader.js:653:32)\n at tryModuleLoad (internal/modules/cjs/loader.js:593:12)\n at Function.Module._load (internal/modules/cjs/loader.js:585:3)\n at Module.require (internal/modules/cjs/loader.js:692:17)\n at require (internal/modules/cjs/helpers.js:25:18)\n at Object. (/home/imobard/.local/share/nvim/lsp_servers/bashls/node_modules/bash-language-server/node_modules/vscode-jsonrpc/lib/common/api.js:37:21)\n at Module._compile (internal/modules/cjs/loader.js:778:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)\n"

sudo bash-language-server stable /usr/local/lib/node_modules/bash-language-server/node_modules/vscode-jsonrpc/lib/common/linkedMap.js:40 return this._head?.value; ^

SyntaxError: Unexpected token . at Module._compile (internal/modules/cjs/loader.js:723:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (/usr/local/lib/node_modules/bash-language-server/node_modules/vscode-jsonrpc/lib/common/api.js:37:21) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

Carlosmape avatar Jul 22 '22 09:07 Carlosmape

Check the engine key in file .../bash-language-server/node_modules/vscode-jsonrpc/package.json. For me, it says:

	"engines": {
		"node": ">=14.0.0"
	},

Upgrading to version of nodejs that fulfills this requirement, fixes the issue.

svenssonaxel avatar Jul 22 '22 10:07 svenssonaxel

Just had same issue on Ubuntu 22.04. I'm not practical with nodejs but it should mean that some token has been added in next version of nodejs (used by linkedMap.js). If you installed nodejs through apt package manager you should have version 12.22.9 and it doesn't work. Maybe there's a cleaner way but I solved with these steps, but be sure to have npm already installed:

sudo npm install -g n
sudo n stable

Once n command is done, it should tell you where it installed the new version of nodejs. Try following the output instructions. If they do not work and node --version still shows 12.22.9 you could find the old executable(s) using whereis node and delete them. Beware, I'm not sure this can't break something. I have not had time to test what's the minimum version required but maybe README.md should be updated.

I feel it a bit sketchy but it worked for me. Maybe someone knows a cleaner way to solve the problem.

THANK YOU. Easy peasy....

TechDufus avatar Oct 06 '22 00:10 TechDufus

The problem causes by node version, I close this issus.

dongdongbh avatar Oct 10 '22 01:10 dongdongbh