kabouzeid/nvim-lspinstall

JSON language server will not run under Node 12.x because...

Opened this issue · 1 comments

jrop commented

...because it makes use of Optional Chaining in its source. I temporarily fixed it by:

  1. Change directory to where the offending JS file is:
cd ~/.local/share/nvim/lspinstall/json/vscode-json/json-language-features/server/dist/node
  1. Create a .babelrc file:
{
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "node": "12"
        }
      }
    ]
  ]
}
  1. Transpile the offending JS file:
npm init -f
npm i @babel/{core,cli,preset-env}
./node_modules/.bin/babel jsonServerMain.js > jsonServerMain.new.js
cp jsonServerMain.js jsonServerMain.js.bak
mv jsonServerMain.new.js jsonServerMain.js
jrop commented

This is probably the wrong place to file this issue, but I'm putting it here to make it searchable