Beginner: problem with the first exercise

I typed the command “npm i @babylonjs/core@preview” in the DOS Command window. A copy process was startet. Not more. I looked for the babylon.js file on the bybylon homepage, but didn’t found it. Therefor I downloaded the whole package from source forge (over 500MB). I created a html-page but the browser shows me the error “engine is not defined”. I think I refer to the wrong babylon.js. Thats the html-page:

< !DOCTYPE html>
< head>
< title>First Test
< /head>
< script src=“5.0.0-alpha.62/BabylonJS-Babylon.js-28a4262/dist/Babylon.js”> < /script>

< script>
const scene = new BABYLON.Scene(engine);
…< /script>
< body></ body>
< /html>

Is it neccessary to Upload all files to my internet server ?

Hello and welcome!
Seems that you mix several different setups and they will not work in this way.
It is possible to use just usual <script> tag in HTML file - Getting Started - Chapter 1 - Setup Your First Web App | Babylon.js Documentation
The fastest way to get the working example - just open the Playground and press Download button (shown at the screenshot below).

3 Likes

From Achim Rogalski
22399 Hamburg / Germany

Dir sirs,
thank you for your help.
I had a new problem with installing sound in my playground.
The console told me "babylon.js:16 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. " It seems that the chrome engine makes problems. Up to this problem I had stored my internet page on my local computer. Then I save the files on my internet server and well - the problem was solved. In the babylon tutorials I would advise the users, that if they have problems, they should try to access the html-page via the Internet. Greetings, Achim Rogalski

2 Likes

Yes, the browser often behaves strangely on local files, we encourage running a local webserver ( serve - npm (npmjs.com) is great) for testing purposes.