Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

215
Vistas
nodejs debugging with non-javascript

In my case, I want to debug CoffeeScript, but this question is NOT CoffeeScript specific. It relates to debugging ANY non-JavaScript language that compiles to JavaScript. To do that, you need to create a sourcemap, which nodejs is capable of. But then, I want to see and step through and inspect variables in my CoffeeScript code, knowing that nodejs will actually be executing the corresponding JavaScript code - mapping the line numbers between them by using the sourcemap. Someone will, no doubt, ask for my source code, so let's just use this (call it temp.coffee):

orders = [341, 454, 198, 264, 307]
totalOrders = 0
debugger
for order in orders
    totalOrders += order
console.log totalOrders

Note that I added a 'debugger' statement, though that should not be necessary - by default, nodejs should stop just before executing the first statement. I've actually come close to achieving my goal by doing this in my terminal:

coffee -cm temp.coffee
node inspect temp.coffee

The first statement compiles temp.coffee into temp.js, also producing file temp.js.map - a sourcemap file. The second statement also appears to work - it tells me that the debugger is attached and gives me a prompt. Unfortunately, if I try to execute the 's' command to step over the next statement in my program, it tells me "Uncaught Error [ERR_DEBUGGER_ERROR]: Can only perform operation while paused." Why is it not paused??? I've tried using the 'run' or 'restart' commands, but I get the same result. I'm hoping that I'm just forgetting to do something and that someone can clue me in.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda