3

This maybe a skool boi error, but I'm getting a 404 for a file that does exist:

http://localhost:8000/Desktop/Skeletor/js/build/three.module.js net::ERR_ABORTED 404 (File not found)

it should say

http://localhost:8000/Desktop/Skeletor/MYPROJECT/js/build/three.module.js

So I'm running a directory short and I can't see why or where I'm going wrong. Yes, I changed from

../build/three.module.js

to

./build/three.module.js

intentionally.

Here's the js in the index.html copied from the three.js webgl loader example

<script type="module">

import * as THREE from './build/three.module.js';

import { OrbitControls } from './jsm/controls/OrbitControls.js';
import { GLTFLoader } from './jsm/loaders/GLTFLoader.js';

The directory structure is this:

MyProject/
    index.html
    .DS_Store
    styles.css
    obj/
        dime_low.glb
    textures/
        00.jpg
    build/
        three.module.js
        .DS_Store
    jsm/
        .DS_Store
        controls/
            .DS_Store
            OrbitControls.js
        loaders/
            .DS_Store
            RGBELoader.js
            GLTFLoader.js

Everything is running locally using a simple HTTP server via Python

Go easy on me, I'm meant to be doing colouring-in today not learning three.js :)

9
  • 1
    Can you please share your directory structure? It's important to know where your HTML file is located and the respective JS files. Commented Jan 21, 2020 at 14:38
  • 1
    It seems you missed jsm before build so it should be import * as THREE from './jsm/build/three.module.js'; Commented Jan 21, 2020 at 16:21
  • 1
    @Zydnar In the official repository, the build files are not located in the jsm directory. Commented Jan 21, 2020 at 20:19
  • What are you using to serve your files in localhost? It might be an issue with the config file, maybe pointing one folder too high. Commented Jan 21, 2020 at 20:19
  • 1
    @Zydnar I see it now! I see where I've gone wrong! D'oh :) Commented Jan 23, 2020 at 16:11

1 Answer 1

1

the build folder must be one folder outside, jsm and build must not be in same directory, try this enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.