# Cannot find some babylonjs module when starting new typescript project

**URL:** <https://forum.babylonjs.com/t/cannot-find-some-babylonjs-module-when-starting-new-typescript-project/45564>\
**Category:** Questions\
**Created:** [November 9, 2023, 9:14am UTC](https://forum.babylonjs.com/t/cannot-find-some-babylonjs-module-when-starting-new-typescript-project/45564 "2023-11-09T09:14:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mayeths](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@mayeths](https://forum.babylonjs.com/u/mayeths)\
**Post date:** [November 9, 2023, 9:14am UTC](https://forum.babylonjs.com/t/cannot-find-some-babylonjs-module-when-starting-new-typescript-project/45564/1 "2023-11-09T09:14:01Z")

</div>

Hi, I’m new to babylonjs and want to start a new project that uses babylonjs with typescript (and electron). However, I consistently encounter typescript build errors. I create an empty folder with the following `package.json`:

```auto
{
  "name": "yourapp",
  "version": "0.0.1",
  "description": "Your Application",
  "main": "./app/main.js",
  "scripts": {
    "build": "tsc",
    "start": "electron ./app/main.js",
    "dist": "build",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "BSD-2-Clause",
  "dependencies": {
    "babylonjs": "6.28.1"
  },
  "devDependencies": {
    "electron": "25.9.4",
    "electron-builder": "24.6.4",
    "typescript": "5.2.2"
  },
  "build": {
    "appId": "yourappid",
    "dmg": {
      "contents": [
        {
          "x": 110,
          "y": 0
        },
        {
          "x": 240,
          "y": 0,
          "type": "link",
          "path": "/Applications"
        }
      ]
    },
    "win": {
      "target": "portable"
    }
  }
}

```

Then after I run `npm install` successfully, I run `npm run build`, result was:

```auto
> yourapp@0.0.1 build
> tsc

node_modules/babylonjs/babylon.module.d.ts:28800:28 - error TS2307: Cannot find module 'babylonjs/Animations' or its corresponding type declarations.

28800 import { Animatable } from "babylonjs/Animations";
                                 ~~~~~~~~~~~~~~~~~~~~~~

node_modules/babylonjs/babylon.module.d.ts:28819:52 - error TS2307: Cannot find module 'babylonjs/Animations' or its corresponding type declarations.

28819 import { Animatable, Animation, IAnimatable } from "babylonjs/Animations";
                                                         ~~~~~~~~~~~~~~~~~~~~~~

node_modules/babylonjs/babylon.module.d.ts:28882:28 - error TS2307: Cannot find module 'babylonjs/Animations' or its corresponding type declarations.

28882 import { Animatable } from "babylonjs/Animations";
                                 ~~~~~~~~~~~~~~~~~~~~~~

node_modules/babylonjs/babylon.module.d.ts:71427:46 - error TS2307: Cannot find module 'babylonjs/Meshes' or its corresponding type declarations.

71427 protected _createVertexBuffers(): import("babylonjs/Meshes").VertexData;
                                                   ~~~~~~~~~~~~~~~~~~

node_modules/babylonjs/babylon.module.d.ts:71537:46 - error TS2307: Cannot find module 'babylonjs/Meshes' or its corresponding type declarations.

71537 protected _createVertexBuffers(): import("babylonjs/Meshes").VertexData;
                                                   ~~~~~~~~~~~~~~~~~~

node_modules/babylonjs/babylon.module.d.ts:176187:18 - error TS2300: Duplicate identifier 'Plane'.

176187 export class Plane {
                        ~~~~~

node_modules/babylonjs/babylon.module.d.ts:184603:11 - error TS2300: Duplicate identifier 'Plane'.

184603 class Plane {
                 ~~~~~

node_modules/babylonjs/babylon.module.d.ts:184655:11 - error TS2300: Duplicate identifier 'Polygon'.

184655 class Polygon {
                 ~~~~~~~

node_modules/babylonjs/babylon.module.d.ts:192657:18 - error TS2300: Duplicate identifier 'Polygon'.

192657 export class Polygon {
                        ~~~~~~~

Found 9 errors in the same file, starting at: node_modules/babylonjs/babylon.module.d.ts:28800

```

My environment is:

```auto
Machine: Macbook Pro with M1 Chip
OS: macOS 13.2.1
node version: 19.7.0 (installed from brew)
npm version: 9.5.0

```

I have to post stuff like this because the problem cannot be reproduced in the playground. Sorry for the inconvenience, and thanks in advance.

---

<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:** [November 9, 2023, 4:27pm UTC](https://forum.babylonjs.com/t/cannot-find-some-babylonjs-module-when-starting-new-typescript-project/45564/2 "2023-11-09T16:27:23Z")

</div>

I believe @RaananW fixed a build error with duplicate names that involved the Polygon class, is that correct?

---

<div class="post-metadata">

**Author:** ![nogalo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nogalo/32/120_2.png) [@nogalo](https://forum.babylonjs.com/u/nogalo)\
**Post date:** [November 9, 2023, 4:47pm UTC](https://forum.babylonjs.com/t/cannot-find-some-babylonjs-module-when-starting-new-typescript-project/45564/3 "2023-11-09T16:47:32Z")

</div>

Try using es6 packages instead

> **[Babylon.js ES6 support with Tree Shaking | Babylon.js Documentation](https://doc.babylonjs.com/setup/frameworkPackages/es6Support)**
>
> Learn about tree shaking and package management in Babylon.js.

`npm i @babylonjs/core`

---

<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:** [November 9, 2023, 5:36pm UTC](https://forum.babylonjs.com/t/cannot-find-some-babylonjs-module-when-starting-new-typescript-project/45564/4 "2023-11-09T17:36:15Z")

</div>

It has been fixed in version 6.29 but I would advice to wait for 6.29.1 as there is an input issue at the moment and we ll republish in no time.

---

<div class="post-metadata">

**Author:** ![mayeths](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@mayeths](https://forum.babylonjs.com/u/mayeths)\
**Post date:** [November 9, 2023, 5:59pm UTC](https://forum.babylonjs.com/t/cannot-find-some-babylonjs-module-when-starting-new-typescript-project/45564/5 "2023-11-09T17:59:24Z")

</div>

Thanks, it works like a charm!
