SyntaxError Cannot use import statement outside a module javascript node js load file into variable

Publié le: 08 mai 2023
sur la chaîne: Tech Nursery
834
2

SyntaxError Cannot use import statement outside a module
(node:12948) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)

import user from './user.json';
^^^^^^

SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47


Sur cette page du site, vous pouvez voir la vidéo en ligne SyntaxError Cannot use import statement outside a module javascript node js load file into variable durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Tech Nursery 08 mai 2023, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 834 fois et il a aimé 2 téléspectateurs. Bon visionnage!