# BABYLON.SceneLoader.ImportMesh Error

**URL:** <https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530>\
**Category:** Questions\
**Created:** [May 19, 2022, 7:15am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530 "2022-05-19T07:15:09Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuemiao](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yuemiao/32/13136_2.png) [@yuemiao](https://forum.babylonjs.com/u/yuemiao)\
**Post date:** [May 19, 2022, 7:15am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/1 "2022-05-19T07:15:09Z")

</div>

BABYLON.SceneLoader.ImportMesh(“obj”, “./testData/DLQHJ/”, “DHQLJ.obj”, this.\_scene,

```
        function (newMeshes) {

            console.log("succeed")

        },

        function (progressEvent) {          

            console.log("progressEvent")

        },

        function (scene, message, exception) {

            console.log("ImportMesh failed: " + message)

        },

        ".pointcloud"

    );

```

ImportMesh failed: Unable to load from ./testData/DLQHJ/DHQLJ.obj: importMesh of undefined from undefined version: undefined, exporter version: undefinedimportMesh has failed JSON parse

---

<div class="post-metadata">

**Author:** ![yuemiao](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yuemiao/32/13136_2.png) [@yuemiao](https://forum.babylonjs.com/u/yuemiao)\
**Post date:** [May 19, 2022, 7:25am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/2 "2022-05-19T07:25:20Z")

</div>

> [@yuemiao](#):
>
> obj

Obj model is a local file

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [May 19, 2022, 8:02am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/3 "2022-05-19T08:02:20Z")

</div>

Are you using a local server?

---

<div class="post-metadata">

**Author:** ![yuemiao](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yuemiao/32/13136_2.png) [@yuemiao](https://forum.babylonjs.com/u/yuemiao)\
**Post date:** [May 19, 2022, 8:15am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/4 "2022-05-19T08:15:37Z")

</div>

No, the obj file is a local resource file

---

<div class="post-metadata">

**Author:** ![yuemiao](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yuemiao/32/13136_2.png) [@yuemiao](https://forum.babylonjs.com/u/yuemiao)\
**Post date:** [May 19, 2022, 8:26am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/5 "2022-05-19T08:26:12Z")

</div>

Even if local services are used:

ImportMesh failed: Unable to load from [http://127.0.0.1:8080/testData/DLQHJ/DHQLJ.obj:](http://127.0.0.1:8080/testData/DLQHJ/DHQLJ.obj:) importMesh of undefined from undefined version: undefined, exporter version: undefinedimportMesh has failed JSON parse

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [May 19, 2022, 8:34am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/6 "2022-05-19T08:34:29Z")

</div>

Have you tried the obj file in the sandbox?

> **[Babylon.js Sandbox - View glTF, glb, obj and babylon files](https://sandbox.babylonjs.com/)**
>
> Viewer for glTF, glb, obj and babylon files powered by Babylon.js

Also is your mesh actually named ‘obj’ ?

Try “” instead of “obj”.

---

<div class="post-metadata">

**Author:** ![yuemiao](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yuemiao/32/13136_2.png) [@yuemiao](https://forum.babylonjs.com/u/yuemiao)\
**Post date:** [May 19, 2022, 8:43am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/7 "2022-05-19T08:43:59Z")

</div>

> [@JohnK](#):
>
> “” instead of “obj”

“” instead of “obj” ，still not successful，same exception，All kinds of attempts just don’t work, and the obj file is OK

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [May 19, 2022, 9:24am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/8 "2022-05-19T09:24:47Z")

</div>

Let’s see if @RaananW can help.

---

<div class="post-metadata">

**Author:** ![yuemiao](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yuemiao/32/13136_2.png) [@yuemiao](https://forum.babylonjs.com/u/yuemiao)\
**Post date:** [May 19, 2022, 10:03am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/9 "2022-05-19T10:03:07Z")

</div>

@RaananW It’s very urgent. Please help

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [May 19, 2022, 10:15am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/10 "2022-05-19T10:15:56Z")

</div>

I have already pinged him, he will reply when he is able. Please remember that help on the forum is voluntary and at a time when it is convenient for community members, who are usually very good with their assistance. Re-pinging a community member is not at all helpful.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [May 19, 2022, 10:24am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/11 "2022-05-19T10:24:32Z")

</div>

> [@JohnK](#):
>
> Please remember that help on the forum is voluntary and at a time when it is convenient for community members

+1 on that one!

Now, about the issue at hand - it feels like you are missing the loaders library, which is required in order to load files other than the .babylon file format. Make sure to include the loaders library, either in your html file or in your npm bundle, depending on how you work.

---

<div class="post-metadata">

**Author:** ![yuemiao](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yuemiao/32/13136_2.png) [@yuemiao](https://forum.babylonjs.com/u/yuemiao)\
**Post date:** [May 19, 2022, 10:29am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/12 "2022-05-19T10:29:26Z")

</div>

BABYLON.SceneLoader.ImportMesh("", “[https://www.lerengebaren.nl/3d/try1/](https://www.lerengebaren.nl/3d/try1/)”, “aj.glb”, this.\_scene,  
function (newMeshes) {  
console.log(“succeed”)  
},

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/b/7/b7aedb16c01a1c9985fedda08c3b9dfedfbd484d.png)

import \* as BABYLON from ‘babylonjs’  
import \* as BABYLONloader from ‘babylonjs-loaders’

![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/e/7/e72e9b283f9ee22e33c681900c01de754cbb332b.png)

![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/8/9/892f5c9e4a9e578e7cf29bc249d8d161a1f2d04f.png)

---

<div class="post-metadata">

**Author:** ![yuemiao](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yuemiao/32/13136_2.png) [@yuemiao](https://forum.babylonjs.com/u/yuemiao)\
**Post date:** [May 19, 2022, 10:32am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/13 "2022-05-19T10:32:25Z")

</div>

My English is not good and I am not good at expression. Please forgive me for offending. Is my use of the above correct? Even using the resources of the official website is not successful

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [May 19, 2022, 10:35am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/14 "2022-05-19T10:35:01Z")

</div>

You have weird quote characters in what you pasted, i assume this is not the case in your code.

It does seem to work - [Babylon.js Playground](https://playground.babylonjs.com/#GH5VMP)

So I would make sure you are really including and bundling the loaders. The loaders package is most certainly missing if it is trying to load a .glb file as a JSON file.

Try running `npm update` , as there might be a version discrepancy between the two.

---

<div class="post-metadata">

**Author:** ![yuemiao](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yuemiao/32/13136_2.png) [@yuemiao](https://forum.babylonjs.com/u/yuemiao)\
**Post date:** [May 24, 2022, 2:13am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/15 "2022-05-24T02:13:48Z")

</div>

As mentioned above, ImportMesh can only be used successfully when it is quoted online. Ts&weckpack can’t succeed all the time,I don’t know why,Can this situation be solved?

---

<div class="post-metadata">

**Author:** ![Blake](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/blake/32/21509_2.png) [@Blake](https://forum.babylonjs.com/u/Blake)\
**Post date:** [May 24, 2022, 3:12am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/16 "2022-05-24T03:12:29Z")

</div>

Maybe you need to use BABYLONloader.ImportMesh instead of Babylon.SceneLoader.ImportMesh if that’s where you imported that functionality into? I’m just guessing thou since I don’t actually import that way (I import the classes one at a time from their path without any BABYLON or BABYLONloader namespaces)…

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [May 24, 2022, 9:13am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/17 "2022-05-24T09:13:37Z")

</div>

I don’t quite understand what doesn’t work, so it’s hard to help. Are you able to reproduce this? Share a project where it is not working?

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [May 24, 2022, 9:57am UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/18 "2022-05-24T09:57:58Z")

</div>

> [@yuemiao](#):
>
> import \* as BABYLONloader from ‘babylonjs-loaders’

Could you try to change this line to

```auto
import "babylonjs-loaders";

```

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [June 22, 2022, 1:02pm UTC](https://forum.babylonjs.com/t/babylon-sceneloader-importmesh-error/30530/19 "2022-06-22T13:02:09Z")

</div>

Hello @yuemiao just checking in, are you still having issues?
