How to build and compile new JS files after modifying the source code

I downloaded the source code in git: https://github.com/BabylonJS/Babylon.js。
I used npm i --save.
Then use npm run build.
prompt error:


How should I be able to build it successfully?

what exactly are you trying to build? you can run build:dev, or run build:babylonjs if you just want the UMD core package to be built. But it all depends on the package you want to build.

Thank you for your reply.
I want to make files like this that allow me to develop my own projects.
7af32333ad285fd1a551fde309e9c58

npm run build:babylonjs will generate the sources you need in packages/public/umd/babylonjs

I used your command and got an error.

Is that the result of npm run build:babylonjs ? are you sure npm install works correctly? (Without --save)

According to what you said, I did it again and still reported the above error.

I checked the index script in src and found an exception.


Cannot find module ‘core/Legacy/legacy’ or its corresponding type declarations。

It seems that the reference address of this file is incorrect, I tried to find it with the correct path, but it didn’t work.

1 Like

did you run npm install successfully? without “–save”?

the tsconfig file has a reference of this path, so it is a perfectly valid package to load from. I assume npm install didn’t run correctly, otherwise nx would find 3 projects to build before it is building babylon.js .

I don’t know if the installation was successful or not, maybe it failed, but I don’t know what caused it.

what node and npm version are you using? what os?

oh, and do you have typescript installed globally? what’s the result of tsc -v?

win11
npm 8.5.5
nodejs 16.15
tsc Not Installed

we continuously test with this system exactly (and with osx and ubuntu), so i find it very odd that you couldn’t run npm install.

Did you make any changes? was there a change to package.json?

Could you try to re-clone the repo and just run npm install right after? is there an error when installing the dependencies themselves, or just when compiling the test tools?

I now download babylonjs again and try npm install → npm run build:babylonjs.
See if it compiles successfully.
Hold on. . .


It seems that the error has been reported since npm install.

There is really no way for me to reproduce this, as I use the exact same system.

Are you sure no changes were made? was that a fresh clone with nothing in node_modules? Does anyone else experience this?

Yes, I downloaded the compressed package from GIT and used it directly.