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

Publicado el: 08 mayo 2023
en el canal de: 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


En esta página del sitio puede ver el video en línea SyntaxError Cannot use import statement outside a module javascript node js load file into variable de Duración hora minuto segunda en buena calidad , que subió el usuario Tech Nursery 08 mayo 2023, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 834 veces y le gustó 2 a los espectadores. Disfruta viendo!