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
2
Answers
Check your node version! you need upgrade to 16 or newer.
Try updating node. Maybe your node version is outdated. uninstall node and reinstall again.