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

1
  • Why didn't you share package.json code? It should work as answered here 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. Commented Apr 16, 2023 at 2:42

2 Answers 2

0

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

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.