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

Error importing module #82

Closed
zeljko-bulatovic opened this issue Mar 13, 2021 · 5 comments
Closed

Error importing module #82

zeljko-bulatovic opened this issue Mar 13, 2021 · 5 comments

Comments

@zeljko-bulatovic
Copy link
Collaborator

Hi,

I am not sure if this is related to hocuspucus server, or to my config, but when i followed tutorial, i am not able to run my server, because of the added import.

I am receiving the following error:
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: .../node_modules/@hocuspocus/server/dist/hocuspocus-server.js
require() of ES modules is not supported.

I am using Babel for build..

Update:

I found that this issue is related to the node version:
manuelbieh/geolib#208

After switching to node version 12.12.0, now i got error from your module:

import WebSocket from 'ws';
^^^^^^

SyntaxError: Cannot use import statement outside a module
....
....

@hanspagel
Copy link
Contributor

Oh, we’ve developed under Node 15. It’s not compatible with older versions, at least for now.

Any chance you could try Node 15?

@zeljko-bulatovic
Copy link
Collaborator Author

Huh, i will try to update my project to node 15 first. Thank you for answer!

@zeljko-bulatovic
Copy link
Collaborator Author

Thank you for forcing me to update the project to the latest node :) It is working now :)

@kriskbx kriskbx transferred this issue from another repository Apr 19, 2021
@kasperpihl
Copy link

I had the same issue, and upgrading to node 16 didn't help.

For others with this issue:
It turned out that I had to set "type": "module" in my package.json, and then I was able to compile.

@philippkuehn
Copy link
Contributor

Yeah for now we only provide ESM modules. And since April 30, every LTS version of node has ESM support.

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

4 participants