Threejs SyntaxError: Unexpected token < in JSON at position 0 (.glb file)

Viewed 959

I'am trying to learn Threejs and I came across this error:

SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at GLTFLoader.parse (GLTFLoader.js:213)
    at Object.onLoad (GLTFLoader.js:145)
    at XMLHttpRequest.<anonymous> (three.module.js:35829)

I'am trying to load a Parrot.glb file and console.log it in onLoad function. I know that my web server does not serve a glb file but HTML content (Response), but what shoud I do next?

For my web sever I'am using Parcel.js...

It is interesting that on the codesendbox it is working properly (it console.log the gltf object): https://codesandbox.io/s/gltfloader-error-mg9in

There is repe on github where you can try it: https://github.com/sleaper/Threejs-test

Thanks for help

0 Answers
Related