josa42 / coc-sh

SH language server extension using bash-language-server for coc.nvim.
MIT License
205 stars 4 forks source link

coc-sh creashed 4 times in 3 minutes and showing syntax error #63

Closed cosmoswafer closed 1 year ago

cosmoswafer commented 2 years ago

Installed version is 0.7.0.

I've tried to remove and install again. Still the same. And the following is the output of CocCommand workspace.showOutput

/home/xxx/.config/coc/extensions/node_modules/coc-sh/node_modules/vscode-jsonrpc/lib/common/linkedMap.js:40
        return this._head?.value;
                          ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/xxx/.config/coc/extensions/node_modules/coc-sh/node_modules/vscode-jsonrpc/lib/common/api.js:37:21)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
[Error  - 下午12:39:08] /home/xxx/.config/coc/extensions/node_modules/coc-sh/node_modules/bash-language-server/bin/main.js exited with code: 1
[Info  - 下午12:39:08] Connection to server got closed. Server will restart.
/home/xxx/.config/coc/extensions/node_modules/coc-sh/node_modules/vscode-jsonrpc/lib/common/linkedMap.js:40
        return this._head?.value;
                          ^

My system is Ubuntu 22.04 and it comes with the nodejs version 12. Should I upgrade it to version 16?

niveK77pur commented 2 years ago

Good catch. I just installed the latest nodejs version (v18.4.0) and the error is gone! I was kinda stuck with this for a while and didn't find any related issues, I was also using nodejs version 12!

Edit: The n module from npm is really great to change node versions. I found it on this post: https://askubuntu.com/a/480642 I think I had to uninstall the nodejs I installed via apt, for coc to recognize the nodejs from n (could also have been one of my vimrc settings on second thought). Otherwise works like a charm~

niveK77pur commented 2 years ago

Interestingly, on my Arch-Linux system, the latest node version (v.18.6.0) does not work. Nor does 18.4.0 which worked on my other machine. Here I need to use node version 16 (v16.16.0) for this extension to not throw this error.

In my previous comment I was using KDE Neon, just for reference. This time I am on Arch Linux.

Edit: Turns out, my coc-sh was outdated. Seems to work now with node v.18.6.0!