Can't build current git master

@JohnK was kind enough to fix an issue I reported: Apply subMaterial to top side of extruded polygon only

Because of that, and for contributing PRs, I tried to compile current master using this guide: Babylon.js/Tools/Gulp at master · BabylonJS/Babylon.js · GitHub

But alas, I got this error:

[19:41:27] 'localdev-es6' errored after 574 ms
[19:41:27] Error: Failed to link the ES6 package.
    at formatError (/usr/lib/node_modules/gulp/node_modules/gulp-cli/lib/versioned/^4.0.0/format-error.js:21:10)
    at Gulp.<anonymous> (/usr/lib/node_modules/gulp/node_modules/gulp-cli/lib/versioned/^4.0.0/log/events.js:33:15)
    at Gulp.emit (events.js:323:22)
    at Gulp.EventEmitter.emit (domain.js:482:12)
    at Object.error (/home/markus/dev/Babylon.js/node_modules/undertaker/lib/helpers/createExtensions.js:61:10)
    at handler (/home/markus/dev/Babylon.js/node_modules/now-and-later/lib/mapSeries.js:47:14)
    at f (/home/markus/dev/Babylon.js/node_modules/once/once.js:25:25)
    at f (/home/markus/dev/Babylon.js/node_modules/once/once.js:25:25)
    at tryCatch (/home/markus/dev/Babylon.js/node_modules/async-done/index.js:24:15)
    at done (/home/markus/dev/Babylon.js/node_modules/async-done/index.js:40:12)
    at Domain.onError (/home/markus/dev/Babylon.js/node_modules/async-done/index.js:51:5)
    at Object.onceWrapper (events.js:418:26)
    at Domain.emit (events.js:311:20)
    at Domain.EventEmitter.emit (domain.js:482:12)
    at Domain._errorHandler (domain.js:262:21)
    at Object.<anonymous> (domain.js:156:29)
[19:41:27] 'deployAndTests-es6Modules' errored after 578 ms
[19:41:27] 'tests-all' errored after 1.72 min
[19:41:27] 'default' errored after 19 min
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! babylonjs@0.0.0 build: `gulp --max-old-space-size=8192 --tsLintFix`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the babylonjs@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/markus/.npm/_logs/2020-04-18T17_41_27_963Z-debug.log

Any idea what might be causing this? Doesn’t look related to the babylon code. I’m gonna try compiling the precious commit just to see if I get the same error. Also, before that it complained about not finding headless chrome (my linux only has Chromium), so the command I used was CHROME_BIN=/usr/bin/chromium npm run build. But that shouldn’t make a difference right?

edit: It runs for longer with the second-to-last nightly commit, so maybe just a bad merge? Also, gulp is spawning about 10 threads but is using 50% CPU max., what’s up with that?

edit two: Nope, same error with that version

Have you read Start Contributing to Babylon.js - Babylon.js Documentation

However I also have problems from time to time doing a build eg NPM Run Build Gives Errors

2 Likes

Thank you. Yes I have read it, but a refresher never hurts. For now I just want to build the latest version though, that’s all.

In your linked thread, I found this post by @Deltakosh: NPM Run Build Gives Errors. So I deleted the node_modules folder in the root (I did try to do an npm run build in the root first before consulting the docs because it didn’t work) and now I’m trying to build again from the Tools/Gulp directory. Editing in the results when it’s finished.

In case you do not know you can find latest preview version here Babylon.js/dist/preview release at master · BabylonJS/Babylon.js · GitHub

Now I’m getting a lot of gltf module errors. Not sure if a package is missing:

ℹ 「atl」: Using typescript@3.8.3 from typescript
ℹ 「atl」: Using tsconfig.json from /home/markus/dev/Babylon.js/loaders/tsconfig.json
ℹ 「atl」: Checking started in a separate process...
✖ 「atl」: Checking finished with 227 errors
[11:10:19] 'buildMin' errored after 12 s
[11:10:19] Error in plugin "webpack-stream"
Message:
    [at-loader] ../../loaders/src/glTF/glTFValidation.ts:1:24 
    TS2307: Cannot find module 'babylonjs-gltf2interface'.
[long stack trace]

This may be my complete ignorance talking, but is this really in the right format for node_modules? It’s the version you include in a <script> tag right? I did follow a link to this dist version at some point, but it doesn’t look like what I need.

Maybe I gotta mention that I would like to include this in a webpack project. I don’t want to rewrite everything to BABYLON. syntax and back again. I am by no means an expert on webpack so maybe I’m going at this all wrong and it’s possible to import this version into a webpack environment somehow. I don’t care so much about tree-shaking it’s just that I don’t want to change more than I need to that I have to change back when I revert to the next stable version.

I am a bit of a recipe follower when it comes to npm, node and webpack and so like you if things do not work out as expected \i am also at a loss. You may have to wait until the version you want is available on npm.

This might or might not work but you could replace for example babylon.max.js in node_modules with the latest version from the dist/preview folder.

1 Like

I think frankly everyone is. Nobody understands the whole system it looks like :wink: And people say C++ build systems are complicated haha

I’m using the @babylonjs version (not sure if the version without the @ is different in that respect) and I don’t have a babylon.max.js file in my node_modules. From my limited understanding of how node modules work, it’s also not obvious why it should be there.

The gulp build process should at least yield me a module that I can put into node_modules right? If I get it to work, that is.

Pinging @sebavan

1 Like

It looks like first there is a build issue in your system we should address and 2 how you could use it locally.

About the issue this format error is highly weird and I never seen this one. As it looks to happen at the npm link step : [19:41:27] Error: Failed to link the ES6 package.

I wonder if you have sufficient privileges on your user to launch npm link commands ???

(We run the build locally on linux machines for automation without issues but the user has high privileges during the build)

About the second issue:

  • The none @ package is a bundle so it contains a single js files
  • The @ one is module based and not bundled to allow tree shaking. It does contains each file from the source simply transpiled to its output version hence why you do not find the single file in node_modules

You can find the result of those builds in the .temp folder of the repo which is where we cook all our temps files and folders so this is where we are trying to npm link from.

Then you could simply in your own code npm link @babylonjs/core to use the freshly build version instead of the server one.

2 Likes

Thanks. Maybe I need to link it as root then in my case. I never changed the default config and I don’t know if this is still up to date or not: Use npm without root or sudo rights on Linux but I need root also to do npm install -g xyz. I had no idea you need root privileges for building though.

I just copied the contents of .temp/distES6 to my project-local node_modules/@babylonjs. It works! Any downsides to this approach? npm link seems messy to me because that installs an experimental version into the global scope (if I understood it correctly), but I only need the version for this one project, and only temporarily.

Actually npm link would be perfect cause it is only installed if you use another npm link … to use it but yes premissions on node and linux are sometimes annoying with link commands depending on the setup. No downside to do as you did aside remembering it to prevent pushing smthg that would not work :slight_smile:

1 Like

Yep, thanks. Worst case when someone forgets it is an annoying texture bug. The next @preview version will fix it anyway.

I had absolutely no idea btw that “linking” referred to npm link. I had the association with an object file linker or something.

So trueeeee it is pretty confusing… but refers to sym links in this case