Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

281
Views
(nodo: 9374) Advertencia: para cargar un módulo ES, establezca "tipo": "módulo"

Acabo de empezar a aprender React hoy. ¿Cómo me deshago de ese mensaje de error en mi Consola en la Terminal en Visual Studio?

 (node: 9374)Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. /Users/nishihaider/workspace-ui/react-todo-app/src/App.js:1
 import React from "react"; import "./App.css"; function App() { <> return ( <h1>ToDo</h1> ); </> } export default App;
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Primero, instale la última versión de Node.js. Tiene las últimas y mejores características.

En segundo lugar, agregue la línea "type": "module" en su archivo package.json .

 { "type": "module" }

En tercer lugar, use la --experimental-modules al invocar nodejs:

node --experimental-modules app.js

¡Usted debe ser bueno para ir!

Una alternativa es evitar agregar la línea "type": "module" en su archivo package.json y, en su lugar, cambiar el nombre de su archivo app.js a app.mjs.

Tenga en cuenta que ahora la sintaxis require() dejará de funcionar .

over 4 years ago · Santiago Trujillo Report

0

Aquí está mi enfoque:

1 - Actualice package.json como:

 "main": "index.js", "type":"module",

2 - use.js al importar, como:

 import {isPrime} from './isPrime.js';

3 - aquí está isPrime.js

 export const isPrime ....
over 4 years ago · Santiago Trujillo Report

0

Solo necesita actualizar package.json de esta manera,

 {"type": "module"}

A mi me funciono, gracias!

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!