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

512
Views
Threejs Scene no funciona en mi proyecto / THREE no definido

Quería crear el proyecto m first three js y seguí un tutorial. Pero cuando mi página se carga, no aparece ninguna escena. La escena debe ser completamente negra, pero el sitio es solo blanco.

Consola del navegador Chrome:

three.js:1 Error al cargar el recurso: net::ERR_FILE_NOT_FOUND main.js:1 Error de sintaxis no capturado: no se puede usar la declaración de importación fuera de un módulo

Mi espacio de trabajo de código vs;

ingrese la descripción de la imagen aquí

Mi código html y js:

 function main(){ var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera(45,window.innerWidth/window.innerHeight,1,1000); var renderer = new THREE.WebGLRenderer(); renderer.setSize(window.innerWidth,window,innerHeight); document.getElementById('webgl').appendChild(renderer.domElement); renderer.render(scene,camera); } main();
 <!DOCTYPE html> <html> <head> <title>Three js test</title> <style type="text/css">html, body {margin: 0; padding: 0; overflow: hidden;}</style> </head> <body> <div id="webgl"></div> <script src="/lib/three.js"></script> <script src="./main.js"></script> </body> </html>

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

0

<script src="lib/three.js"></script>

¿Tal vez intente eliminar el '/' de su ruta three.js?

about 4 years ago · Juan Pablo Isaza Report

0

Terminé trabajando con la extensión del servidor en vivo de vs code y usé three.module.js.

Funcionó usando esto.

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!