# Unable to import mesh

**URL:** <https://forum.babylonjs.com/t/unable-to-import-mesh/20298>\
**Category:** Questions\
**Tags:** material\
**Created:** [April 25, 2021, 10:43am UTC](https://forum.babylonjs.com/t/unable-to-import-mesh/20298 "2021-04-25T10:43:24Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayanthi](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@jayanthi](https://forum.babylonjs.com/u/jayanthi)\
**Post date:** [April 25, 2021, 10:43am UTC](https://forum.babylonjs.com/t/unable-to-import-mesh/20298/1 "2021-04-25T10:43:24Z")

</div>

I’m unable to import mesh using ImportMeshAsync function. I followed the docs [Importing Meshes | Babylon.js Documentation](https://doc.babylonjs.com/guidedLearning/createAGame/importMeshes) .  
I’m getting the below console error when I do it in my local.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/c/c25dc0388c4c641d856b2a9d1e3acdca0dfd6b85.png)

I’m using these imports.

```
<script src="https://cdn.babylonjs.com/babylon.max.js"></script>

<script src="js/sceneLoader.js" type="module"></script>

<script src="https://cdn.babylonjs.com/serializers/babylonjs.serializers.js"></script>

<script src="https://cdn.babylonjs.com/serializers/babylonjs.serializers.min.js"></script>

```

And I’ve specified the file path correctly.  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/c/ce667939acd9643a4cbcde3336727877a39e17dc.png)

PG link - [https://playground.babylonjs.com/#PE4GC4#1](https://playground.babylonjs.com/#PE4GC4#1)

Am I missing anything ?  
@Cedric @Evgeni_Popov Kindly suggest me.

TIA.

---

<div class="post-metadata">

**Author:** ![Dshah\_H](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dshah_h/32/3607_2.png) [@Dshah\_H](https://forum.babylonjs.com/u/Dshah_H)\
**Post date:** [April 25, 2021, 12:43pm UTC](https://forum.babylonjs.com/t/unable-to-import-mesh/20298/2 "2021-04-25T12:43:15Z")

</div>

when using GitHub, use external link `raw.githubusercontent.com`  
[https://playground.babylonjs.com/#PE4GC4#2](https://playground.babylonjs.com/#PE4GC4#2)

---

<div class="post-metadata">

**Author:** ![jayanthi](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@jayanthi](https://forum.babylonjs.com/u/jayanthi)\
**Post date:** [April 26, 2021, 3:15am UTC](https://forum.babylonjs.com/t/unable-to-import-mesh/20298/3 "2021-04-26T03:15:17Z")

</div>

@Dshah_H thanks for pointing that. But can you please look into the error which I posted it from my local.  
I gave some github link just to work in PG so that I can share it here. Anyways, providing [raw.githubusercontent.com](http://raw.githubusercontent.com) worked.

I tried giving my localhost url in PG, then also I didn’t get any output. I’ve the required files in the given file path.  
[https://playground.babylonjs.com/#PE4GC4#3](https://playground.babylonjs.com/#PE4GC4#3)

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/2/21c3d471b4343e5a2d8834195d447841ccac5dec.png)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 26, 2021, 8:35am UTC](https://forum.babylonjs.com/t/unable-to-import-mesh/20298/4 "2021-04-26T08:35:45Z")

</div>

You have too many parameters to `ImportMeshAsync`, you shoud remove `""`:

```javascript
BABYLON.SceneLoader.ImportMeshAsync(['AnimatedMorphCube'], 
 "http://localhost:8000/scene_input/", 'AnimatedMorphCube.gltf', scene);

```

---

<div class="post-metadata">

**Author:** ![jayanthi](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@jayanthi](https://forum.babylonjs.com/u/jayanthi)\
**Post date:** [April 26, 2021, 9:12am UTC](https://forum.babylonjs.com/t/unable-to-import-mesh/20298/5 "2021-04-26T09:12:10Z")

</div>

Removed extra quotes - [https://playground.babylonjs.com/#PE4GC4#7](https://playground.babylonjs.com/#PE4GC4#7)  
But still blank output.

JFYI - I have downloaded the same file to my local and using the same one which I tried on github one [https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/AnimatedMorphCube/glTF-Binary/AnimatedMorphCube.glb](https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/AnimatedMorphCube/glTF-Binary/AnimatedMorphCube.glb) ( PG link posted in my previous comment - [https://playground.babylonjs.com/#PE4GC4#2](https://playground.babylonjs.com/#PE4GC4#2) )

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 26, 2021, 9:35am UTC](https://forum.babylonjs.com/t/unable-to-import-mesh/20298/6 "2021-04-26T09:35:52Z")

</div>

This PG does work:

[https://playground.babylonjs.com/#PE4GC4#8](https://playground.babylonjs.com/#PE4GC4#8)

So if you replace the url by a local url it should work too, provided you have correctly setup your local web server.

---

<div class="post-metadata">

**Author:** ![jayanthi](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@jayanthi](https://forum.babylonjs.com/u/jayanthi)\
**Post date:** [April 26, 2021, 9:49am UTC](https://forum.babylonjs.com/t/unable-to-import-mesh/20298/7 "2021-04-26T09:49:33Z")

</div>

I ran python http server on my local path and made use of that. (“python -m http.server” used this command)

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/c/c172ce7737062e64617650b096fe0726681ef8ba.png)  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/6/68c38a972527bc431616564b091d26c6cbdeddca.png)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 26, 2021, 11:01am UTC](https://forum.babylonjs.com/t/unable-to-import-mesh/20298/8 "2021-04-26T11:01:27Z")

</div>

So, does it work? What do you have in the browser console?

The gltf file is found so it should work.

Just in case, you can try to replace `http://localhost:8000/scene_input/` with `./scene_input/`.

---

<div class="post-metadata">

**Author:** ![jayanthi](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@jayanthi](https://forum.babylonjs.com/u/jayanthi)\
**Post date:** [April 26, 2021, 11:30am UTC](https://forum.babylonjs.com/t/unable-to-import-mesh/20298/9 "2021-04-26T11:30:37Z")

</div>

It didn’t work even though that file is present.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/c/cc01426bbf690e6a37edf5e04eb485e433c7fc43.png)

---

<div class="post-metadata">

**Author:** ![jayanthi](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@jayanthi](https://forum.babylonjs.com/u/jayanthi)\
**Post date:** [April 26, 2021, 11:33am UTC](https://forum.babylonjs.com/t/unable-to-import-mesh/20298/10 "2021-04-26T11:33:03Z")

</div>

@Evgeni_Popov I tried writing the code in my VS code by giving the file path from my local disk. It’s showing up this error

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/5/5046dd8e89b90b3b9491241ea5f88dfd6569bc78.png)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 26, 2021, 12:29pm UTC](https://forum.babylonjs.com/t/unable-to-import-mesh/20298/11 "2021-04-26T12:29:26Z")

</div>

Try to use `babylonjs.loaders.js` instead of `babylon.glTF1FileLoader.js` as your file is probably not a gltf1 file.

---

<div class="post-metadata">

**Author:** ![jayanthi](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@jayanthi](https://forum.babylonjs.com/u/jayanthi)\
**Post date:** [April 27, 2021, 6:56am UTC](https://forum.babylonjs.com/t/unable-to-import-mesh/20298/12 "2021-04-27T06:56:57Z")

</div>

I’ve included it, still seeing this error

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/1/14e0931a6993cb6cb79b67227fb35623122df544.png)  
I’m not sure, why it’s not able to find babylon.glTF1FileLoader.js / babylon.glTF2FileLoader.js .Do I need something to get these included.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 27, 2021, 8:24am UTC](https://forum.babylonjs.com/t/unable-to-import-mesh/20298/13 "2021-04-27T08:24:52Z")

</div>

You need to include the packages in your page to be able to use the functions from them. See what the Playground is doing:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/1/129015d39294088a87866ab7016d809ebe6ad84a.png)

---

<div class="post-metadata">

**Author:** ![jayanthi](https://avatars.discourse-cdn.com/v4/letter/j/58f4c7/32.png) [@jayanthi](https://forum.babylonjs.com/u/jayanthi)\
**Post date:** [April 28, 2021, 3:31am UTC](https://forum.babylonjs.com/t/unable-to-import-mesh/20298/14 "2021-04-28T03:31:46Z")

</div>

@Evgeni_Popov have included all the imports.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/5/5be74587d62f368998962ed59958ece4f71f1c06.png)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 28, 2021, 10:24am UTC](https://forum.babylonjs.com/t/unable-to-import-mesh/20298/15 "2021-04-28T10:24:59Z")

</div>

It seems to be a bug in your code handling the onSuccess task: you try to set a position for an object which is undefined. You will need to debug this on your side, we won’t be able to help more except if you can provide a PG that reproduces the error.
