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

404
Views
SyntaxError: no se puede usar la declaración de importación fuera de un módulo al configurar socket.io en adonisjs

estoy siguiendo socketio con adonisjs para poder implementar sockets web pero me sale este error

 [ info ] building project... [ info ] starting http server... SyntaxError: Cannot use import statement outside a module at /home/../providers/AppProvider.ts(anonymous):18 13 } 14 15 public async ready () { 16 // App is ready 17 if (this.app.environment === 'web') { 18 await import('../start/socket') 19 20 } 21 } 22 23 public async shutdown () { [ encore ] Running webpack-dev-server ... [ warn ] Underlying HTTP server died with "0 code"

cuando pruebo esta solución de agregar "type": "module", a paquete.json obtengo otros errores

¿Cómo puedo arreglar esto?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Resulta que estaba usando start/socket.js en lugar de start/socket.ts .

about 4 years ago · Juan Pablo Isaza Report

0

{ "name": "socket", "version": "1.0.0", "description": "", "main": "index.js", "type": "module", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "nodemon": "^2.0.15", "socket.io": "^4.4.0" } }

Verifique su archivo package.json, falta "tipo": "módulo", ¡asegúrese de agregar esto como se muestra en este!

about 4 years ago · Juan Pablo Isaza 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!