Skip to content
This repository has been archived by the owner on Oct 16, 2021. It is now read-only.

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

Open
jrop opened this issue Sep 8, 2021 · 1 comment
Open

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

jrop opened this issue Sep 8, 2021 · 1 comment

Comments

@jrop
Copy link

jrop commented Sep 8, 2021

...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
Copy link
Author

jrop commented Sep 8, 2021

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant