Too Long; Didn't Read
Node.js error: Cannot use import statement outside a module. This error arises when we try to use `import` inside of a project which is not set up for modules. The reason why this error occurs is because we have to explicitly tell Javascript that the file in question is a `module` The error can be resolved in two ways: updating your package.json and changing the file extension to 'mjs' The second place this error can occur is in a script tag, like this: Add 'type="my module" to your script tag.