I want to know what's mean the following error in OpenLayers

Uncaught SyntaxError: Cannot use import statement outside a module

I get this error only when I try to execute on the following example


  • 1
    Don't forget about the JS bundling aspect described in the OL Getting Started doc. See this post too
    – JGH
    Aug 25, 2021 at 11:48

1 Answer 1


You need to get basic setup like nodejs in order to run openlayers examples.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.