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

339
Views
Javascript - Error: archivo de análisis *: token inesperado

Estoy tratando de usarlo con enable3d.io + geckos.io pero Error: Analizando archivo ../server.js: Token inesperado ¿Por qué recibo este error?

este es mi codigo

 import geckos from '@geckos.io/server' import { createServer } from 'http' import { promises } from "fs"; const { readFile, writeFile } = promises; // import http from 'http' const io = geckos() const indexHtml = await readFile('src/index.html', { encoding: 'utf-8' }) const geckosJs = await readFile('src/js/geckos.io-client.2.1.2.min.js', { encoding: 'utf-8', }) const requestListener = async (req, res) => { if (req.url === '/') return res.writeHead(200, { 'Content-Type': 'text/html' }).end(indexHtml) if (req.url === 'src/js/geckos.io-client.2.1.2.min.js') return res .writeHead(200, { 'Content-Type': 'application/javascript' }) .end(geckosJs) return res.writeHead(404).end() } const server = createServer(requestListener) io.addServer(server) io.onConnection(channel => { channel.onDisconnect(() => { console.log('User ' + client.id + ' connected, there are ' + io.engine.clientsCount + ' clients connected') //Add a new client indexed by his id clients[client.id] = { position: [0, 0, 0], rotation: [0, 0, 0] } //Make sure to send the client it's ID client.emit('introduction', client.id, io.engine.clientsCount, Object.keys(clients)) //Update everyone that the number of users has changed io.sockets.emit('newUserConnected', io.engine.clientsCount, client.id, Object.keys(clients)) console.log(`${channel.id} got disconnected`) }) //Handle the disconnection client.on('disconnect', ()=>{ //Delete this client from the object delete clients[client.id] io.sockets.emit('userDisconnected', io.engine.clientsCount, client.id, Object.keys(clients)) console.log('User ' + client.id + ' dissconeted, there are ' + io.engine.clientsCount + ' clients connected') }) channel.on('chat message', data => { console.log(`got ${data} from "chat message"`) // emit the "chat message" data to all channels in the same room io.room(channel.roomId).emit('chat message', data) }) }) io.listen(3000) // default port is 9208

estoy creando un servicio multijugador WebGL Como desarrollador novato, estoy mirando ejemplos, pero tengo una pregunta que no sé. y la captura de pantalla de error está aquí

ingrese la descripción de la imagen aquí

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