# Babylonjs Materials Library giving error

**URL:** <https://forum.babylonjs.com/t/babylonjs-materials-library-giving-error/26112>\
**Category:** Questions\
**Tags:** material\
**Created:** [December 16, 2021, 9:09am UTC](https://forum.babylonjs.com/t/babylonjs-materials-library-giving-error/26112 "2021-12-16T09:09:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Swastik\_K](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/swastik_k/32/20550_2.png) [@Swastik\_K](https://forum.babylonjs.com/u/Swastik_K)\
**Post date:** [December 16, 2021, 9:09am UTC](https://forum.babylonjs.com/t/babylonjs-materials-library-giving-error/26112/1 "2021-12-16T09:09:25Z")

</div>

Getting error for the babylonjs materials library

**HTML Code:**

```auto
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ScrollShape</title>
    <style>
        html, body {
            overflow: hidden;
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }

        #renderCanvas {
            width: 100%;
            height: 100%;
            touch-action: none;
        }
    </style>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/babylonjs/4.2.0/babylon.js"></script>
    <!-- <script src="https://cdn.babylonjs.com/babylon.js"></script> -->
    <script src="https://preview.babylonjs.com/materialsLibrary/babylonjs.materials.min.js"></script>
    <script src="https://unpkg.com/earcut@2.1.1/dist/earcut.min.js"></script>
    <script src="https://cdn.babylonjs.com/ammo.js"></script>

</head>
<body>
    <canvas id = "renderCanvas"></canvas>
    <script src="js/app.js"></script>
</body>
</html>

```

**Error Sceenshot:**

 ![Screenshot 2021-12-16 at 2.40.09 PM](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/a/fa00d4988758f8a157cd438599deb1ea4c406e05.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:** [December 16, 2021, 10:11am UTC](https://forum.babylonjs.com/t/babylonjs-materials-library-giving-error/26112/2 "2021-12-16T10:11:26Z")

</div>

I don’t know if it’s the problem but you should not mix the versions of the packages: `https://preview.babylonjs.com/materialsLibrary/babylonjs.materials.min.js` is 5.0 whereas you load Babylon.js 4.2.0: you should use the 4.2.0 version of the materials library package.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [December 16, 2021, 10:19am UTC](https://forum.babylonjs.com/t/babylonjs-materials-library-giving-error/26112/3 "2021-12-16T10:19:37Z")

</div>

This would definitely be the issue 🙂

Please, either you should always use preview or always cdn, not mixing here will help a lot

---

<div class="post-metadata">

**Author:** ![Swastik\_K](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/swastik_k/32/20550_2.png) [@Swastik\_K](https://forum.babylonjs.com/u/Swastik_K)\
**Post date:** [December 16, 2021, 10:26am UTC](https://forum.babylonjs.com/t/babylonjs-materials-library-giving-error/26112/4 "2021-12-16T10:26:58Z")

</div>

Where can I find cdn of materials library, I can only see preview everywhere.

It would really help me If you could share the link here

Thank you

---

<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:** [December 16, 2021, 10:40am UTC](https://forum.babylonjs.com/t/babylonjs-materials-library-giving-error/26112/5 "2021-12-16T10:40:36Z")

</div>

It’s the same link than the preview one but with `cdn` instead of `preview`:

[https://cdn.babylonjs.com/materialsLibrary/babylonjs.materials.min.js](https://cdn.babylonjs.com/materialsLibrary/babylonjs.materials.min.js)

---

<div class="post-metadata">

**Author:** ![Swastik\_K](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/swastik_k/32/20550_2.png) [@Swastik\_K](https://forum.babylonjs.com/u/Swastik_K)\
**Post date:** [December 16, 2021, 12:34pm UTC](https://forum.babylonjs.com/t/babylonjs-materials-library-giving-error/26112/6 "2021-12-16T12:34:02Z")

</div>

@Evgeni_Popov Thank you so much 🙏, It is working now
