Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require of ES Modules not supported error when attempting to run v0.6.0 #38

Closed
Issafalcon opened this issue Apr 26, 2022 · 3 comments
Closed

Comments

@Issafalcon
Copy link

👓 What did you see?

After recent updates to the language server, I tested it out using the cucumber-lsp in Neovim (v0.7.0) and got the following client error:
[ERROR][2022-04-26 18:54:51] .../vim/lsp/rpc.lua:420 "rpc" "cucumber-language-server" "stderr" 'Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/issafalcon/.local/share/nvim/lsp_servers/cucumber_language_server/node_modules/@cucumber/language-server/dist/cjs/src/startServer.js\nrequire() of ES modules is not supported.\nrequire() of /home/issafalcon/.local/share/nvim/lsp_servers/cucumber_language_server/node_modules/@cucumber/language-server/dist/cjs/src/startServer.js from /home/issafalcon/.local/share/nvim/lsp_servers/cucumber_language_server/node_modules/@cucumber/language-server/bin/cucumber-language-server.cjs is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.\nInstead rename startServer.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/issafalcon/.local/share/nvim/lsp_servers/cucumber_language_server/node_modules/@cucumber/language-server/package.json.\n\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1089:13)\n at Module.load (internal/modules/cjs/loader.js:937:32)\n at Function.Module._load (internal/modules/cjs/loader.js:778:12)\n at Module.require (internal/modules/cjs/loader.js:961:19)\n at require (internal/modules/cjs/helpers.js:92:18)\n at Object.<anonymous> (/home/issafalcon/.local/share/nvim/lsp_servers/cucumber_language_server/node_modules/@cucumber/language-server/bin/cucumber-language-server.cjs:3:25)\n at Module._compile (internal/modules/cjs/loader.js:1072:14)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)\n at Module.load (internal/modules/cjs/loader.js:937:32)\n at Function.Module._load (internal/modules/cjs/loader.js:778:12)\n'

✅ What did you expect to see?

The lsp client should load correctly without errors

📦 Which tool/library version are you using?

Latest version (0.6.0) of cucumber_language_server. Neovim 0.7.0

🔬 How could we reproduce it?

Steps to reproduce the behavior:

  1. Attempt to run the cucumber_language_server script

📚 Any additional context?


This text was originally generated from a template, then edited by hand. You can modify the template here.

@aslakhellesoy
Copy link
Contributor

I believe this will be fixed by #39

@aslakhellesoy
Copy link
Contributor

@Issafalcon can you try with 0.7.0 and see if that fixes the problem?

@Issafalcon
Copy link
Author

@aslakhellesoy - Just tried it. That did the trick, thanks!

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

No branches or pull requests

2 participants