I also have this similar kind of error on version 6.36.0:
Typecheck started…
node_modules/babylonjs/babylon.module.d.ts(28482,28): error TS2307: Cannot find module 'babylonjs/Animations' or its corresponding type declarations.
node_modules/babylonjs/babylon.module.d.ts(28501,28): error TS2307: Cannot find module 'babylonjs/Animations' or its corresponding type declarations.
node_modules/babylonjs/babylon.module.d.ts(28570,28): error TS2307: Cannot find module 'babylonjs/Animations' or its corresponding type declarations.
node_modules/babylonjs/babylon.module.d.ts(71612,46): error TS2307: Cannot find module 'babylonjs/Meshes' or its corresponding type declarations.
node_modules/babylonjs/babylon.module.d.ts(71722,46): error TS2307: Cannot find module 'babylonjs/Meshes' or its corresponding type declarations.
✖ Typecheck failed with 5 errors
ℹ Typecheck finished in 1741ms
Here is tsconfig.json
{
"compilerOptions": {
"target": "es2016",
"module": "ESNext",
"moduleResolution": "node",
"noResolve": false,
"noImplicitAny": false,
"sourceMap": true,
"preserveConstEnums":true,
"lib": [
"dom",
"es2020"
]
}
}
Here is my package json:
...
"dependencies": {
"babylonjs": "^6.36.0",
"babylonjs-gui": "^6.36.0",
"babylonjs-materials": "^6.36.0",
}
Here is the typescript code:
import * as BABYLON from "babylonjs";
import * as MAT from "babylonjs-materials";
class App {
constructor() {
// create the canvas html element and attach it to the webpage
var canvas = document.createElement("canvas");
canvas.style.width = "100%";
canvas.style.height = "100%";
canvas.id = "gameCanvas";
document.body.appendChild(canvas);
// initialize babylon scene and engine
var engine = new BABYLON.Engine(canvas, true);
var scene = new BABYLON.Scene(engine);
// This creates and positions a free camera (non-mesh)
var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -10), scene);
// This targets the camera to scene origin
camera.setTarget(BABYLON.Vector3.Zero());
// This attaches the camera to the canvas
camera.attachControl(canvas, true);
var light1: BABYLON.HemisphericLight = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(1, 1, 0), scene);
var sphere = BABYLON.CreateSphere("sphere", { diameter: 1 }, scene);
// Create a grid material
var material = new MAT.GridMaterial("grid", scene);
// Our built-in 'sphere' shape.
var sphere = BABYLON.MeshBuilder.CreateSphere("sphere1", { segments: 16, diameter: 2 }, scene);
// Move the sphere upward 1/2 its height
sphere.position.y = 2;
// Affect a material
sphere.material = material;
// Our built-in 'ground' shape.
var ground = BABYLON.MeshBuilder.CreateGround("ground1", { width: 6, height: 6, subdivisions: 2 }, scene);
// Affect a material
ground.material = material;
// hide/show the Inspector
window.addEventListener("keydown", (ev) => {
// Shift+Ctrl+Alt+I
if (ev.shiftKey && ev.ctrlKey && ev.altKey && ev.key === 'i') {
if (scene.debugLayer.isVisible()) {
scene.debugLayer.hide();
} else {
scene.debugLayer.show();
}
}
});
// run the main render loop
engine.runRenderLoop(() => {
scene.render();
});
}
}
new App();
Any ideas? Thanks