Skip to content

Tutorial error: Cannot use import statement outside a module #8

@mrhappyasthma

Description

@mrhappyasthma
M:\src\server.js:1
import { Server } from "@ravens-engine/core/lib/server/index.js";
^^^^^^

SyntaxError: Cannot use import statement outside a module

It seems this can be resolved by adding "type": "module", manually to the package.json or using the .mjs file extension (source).

But it seems some recommended advice from searching around on google is to use require instead.

I'm not a web dev, so not sure what the recommended practice for ravens-engine is. But the tutorial should be updated to account for this, as I got quite stumped for a bit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions