# Error in BufferGeometryUtils

**URL:** <https://discourse.threejs.org/t/error-in-buffergeometryutils/23657>\
**Category:** Questions\
**Tags:** geometry\
**Created:** [February 19, 2021, 4:10pm UTC](https://discourse.threejs.org/t/error-in-buffergeometryutils/23657 "2021-02-19T16:10:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qjr](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/qjr/32/13574_2.png) [@Qjr](https://discourse.threejs.org/u/Qjr)\
**Post date:** [February 19, 2021, 4:10pm UTC](https://discourse.threejs.org/t/error-in-buffergeometryutils/23657/1 "2021-02-19T16:10:12Z")

</div>

Unfortunately, but the library crashes an error:  
Uncaught TypeError: Cannot read property ‘mergeBufferGeometries’ of undefined  
The library loads correctly because it adds console.log (“lib load”) to this library and it appears in my logs.  
Unfortunately, the use of:  
THREE.BufferGeometryUtils.mergeBufferGeometries (Geometry, true);  
It shows the above-mentioned error.

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [February 19, 2021, 4:43pm UTC](https://discourse.threejs.org/t/error-in-buffergeometryutils/23657/2 "2021-02-19T16:43:10Z")

</div>

Do you mind demonstrating the error with a live example? You can modify the following fiddle which already uses `mergeBufferGeometries()`: [https://jsfiddle.net/j3dakqmr/](https://jsfiddle.net/j3dakqmr/)

---

<div class="post-metadata">

**Author:** ![Qjr](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/qjr/32/13574_2.png) [@Qjr](https://discourse.threejs.org/u/Qjr)\
**Post date:** [February 19, 2021, 6:01pm UTC](https://discourse.threejs.org/t/error-in-buffergeometryutils/23657/3 "2021-02-19T18:01:56Z")

</div>

I think I know where the error is.  
Unfortunately, I will not show you this on an example because:  
I use a lot of files to break down the code and there seems to be a bug in that.  
BufferGeometryUtils is not declared a global variable.  
I mean, from what I see in the code it is, but it doesn’t penetrate into the code in other files like the rest of the threejs library.

In addition, I noticed that:

```javascript
       <script src = 'https: //cdn.jsdelivr.net/npm/three@0.125.2/build/three.js'> </script>
        <script type = "module">
        import * as THREE from 'https://cdn.jsdelivr.net/npm/three@0.125.2/build/three.module.js';>
        </script>
        <script type = "module">
        import {BufferGeometryUtils} from 'https://cdn.jsdelivr.net/npm/three@0.125.2/examples/jsm/utils/BufferGeometryUtils.js';>
        </script>

```

Causes a duplicate instance of the library.  
I had to remove \<to make it display.  
How to add code in posts?

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [February 20, 2021, 12:23pm UTC](https://discourse.threejs.org/t/error-in-buffergeometryutils/23657/4 "2021-02-20T12:23:48Z")

</div>

> [@Qjr](#):
>
> How to add code in posts?

Use three ` signs to start and end a code section.
