Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

217
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda