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

313
Vistas
javascript ReferenceError: document is not defined How to set vs code to run in the browser instead of node.js?

Whenever I try to access the document object in vs code I get ReferenceError: document is not defined. It seems the problem is code running in node.js which doesn't have the document thing.

My question is how do I set the vs code to run on the browser only, to be able to access DOM elements. I have installed Live server extension but the code still runs in node.js which gets me the error and I can`t properly check if the code is working the way I want. So please.. How do I solve this problem? How do I change the runtime environment in vs code?

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

You don't need a server to do this.

Open the HTML file directly inside of the browser.

It will execute your scripts as Common JS.

about 4 years ago · Santiago Gelvez Denunciar
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