Load resources failed in nodejs environment

I am trying to use babylon in nodejs. I imported babylon like below
import * as BABYLON from ‘babylonjs’;
import * as GUI from ‘babylonjs-gui’;
import ‘babylonjs-loaders’;

I can create scene, engine and GUI without any issue. However, when I tried to load glb files to scene, the error would come. It seemed I didn’t get the correct resource. My code below:
BABYLON.SceneLoader.Append("./resources/moves/", “lurh.glb”, scene) {
//do something
It said magic number is wrong. But the file can be load in sandbox.
I always got this error no matter what the resource files are.
BTW, I can use binary data directly without any issue.
var base64_model_content = “data:base64,Z2xURgIAAA…”
BABYLON.SceneLoader.Append("", base64_model_content, scene, function () {
scene.createDefaultCamera(true, true, true);
Please help. Thanks.

Hmm. It’s hard to say.

I use this process and it works for me. Maybe it helps to check it out if you already didn’t

1 Like

I just used the http(https://xx.xx.xx.xx/resources/moves) method instead of “./resources/moves” and it worked. Problem solved.

1 Like