GLTFLoader itemStart Error

Hi! I’m pretty new to Three.js. I’m following this tutorial: https://discoverthreejs.com

Im running the tutorial locally using express to serve the content, and I’m recieving this error while trying to load a Gltf model:

GLTFLoader.js:47 Uncaught TypeError: Cannot read property ‘itemStart’ of undefined
at GLTFLoader.load (GLTFLoader.js:47)
at loadModels (scripts.js:90)
at init (scripts.js:21)
at scripts.js:148

Any helps is really welcomed.

Thanks!

Can you please share your code that shows how you are loading the glTF asset?

hi. have the same issue with current latest loader (examples/js/loaders/GLTFLoader.js)

var loader = new THREE.GLTFLoader();
loader.load(‘1.gltf’), function( gltf){
console.log(gltf)
}

@Gase12 have you tried with this syntax? The callback function needs to be passed as the second argument.

var loader = new THREE.GLTFLoader();
loader.load( '1.gltf' , function( gltf ){
  console.log( gltf );
});

ops.
yes this works with current master. but on dev branch i seem to have the same line 47 issue as mentioned above…

The following example from the dev branch works fine:

https://raw.githack.com/mrdoob/three.js/dev/examples/webgl_loader_gltf.html

Please ensure that GLTFLoader and three.js are from the same release.

Hi I think the problem is we are linking to your developer version and because of changes, that affects/breaks our projects. How can we fix this?

I would recommend against linking directly to developer versions of the library; they will change. :slight_smile:

Alternatives here: add examples/jsm, examples/js folders to CDN and change three.js CDN path · Issue #17522 · mrdoob/three.js · GitHub

I have the same problem since the last release (r109?). I refer to
https://threejs.org/examples/js/loaders/GLTFLoader.js

I need to use SAPUI5 which is still on version r100. The code looks like this:

	jQuery.ajax({
		url: gltfLoaderURL,
		dataType: "script",
		cache: true
	}).done(function () {
		var loader = new THREE.GLTFLoader();
		loader.load("resources/Forklift.gltf", function (gltf) {
			gltf.scene.traverse(function (node) {
				if (node instanceof THREE.Mesh) {
					node.castShadow = true;
				}
			});
			gltf.scene.name = "Forklift";
			gltf.scene.position.x = 15;
			gltf.scene.position.y = 0;
			gltf.scene.position.z = 24;
			scene.add(gltf.scene);
		}, undefined, function (error) {
			console.error(error);
		});
	});

Error:

GLTFLoader.js:47 Uncaught TypeError: Cannot read property ‘itemStart’ of undefined
at GLTFLoader.load (GLTFLoader.js:47)
at Object. (whseView.controller.js:42)
at p (jquery-dbg.js:3192)
at Object.fireWith [as resolveWith] (jquery-dbg.js:3322)
at h3 (jquery-dbg.js:8790)
at HTMLScriptElement.b (jquery-dbg.js:9281)
at HTMLScriptElement.dispatch (jquery-dbg.js:4742)
at HTMLScriptElement.c3.handle (jquery-dbg.js:4554)

And I can say it worked before. Any idea? Or any link to the previous version? That would be very helpful.

GLTFLoader and three.js must be form the same release. In general, we do not support compatibility across different release version since it would not allow us to make any kind of sensible progress in development. So always use the version of GLTFLoader that matches your three.js version.

Thank you very much for that fast answer and of course I understand. How can I access the previous version? I can’t go to r109 as the surrounding framework (SAPUI5) can’t be changed. So I would like to use an older version of GLTFLoader.

Here is the version from R100:

https://rawcdn.githack.com/mrdoob/three.js/r100/examples/js/loaders/GLTFLoader.js

It’s working again, thank you so much for your help!:blush:

1 Like