1

I am trying to use the npm package editly.

import Editly from "editly"

However when i try to import it i get this error.

SyntaxError: Cannot use import statement outside a module at internalCompileFunction (node:internal/vm:73:18) at wrapSafe (node:internal/modules/cjs/loader:1176:20) at Module._compile (node:internal/modules/cjs/loader:1218:27) at Module._extensions..js (node:internal/modules/cjs/loader:1308:10) at Module.load (node:internal/modules/cjs/loader:1117:32) at Module._load (node:internal/modules/cjs/loader:958:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47

All the solutions i have viewed say to add "type": "module" to package.json but it already has it

Shahan
  • 23
  • 3
  • Why didn't you share package.json code? It should work as [answered here](https://stackoverflow.com/a/68558580/12737879) if you have it in the top upmost level by that I mean make sure it's not nested in some other property by mistake. – Aleksandar Apr 16 '23 at 02:42

2 Answers2

0

Check your node version! you need upgrade to 16 or newer.

André
  • 1,602
  • 2
  • 12
  • 26
0

Try updating node. Maybe your node version is outdated. uninstall node and reinstall again.