BabylonReactNative in new react native project that's not the playground

Hi!

I’ve done some testing in the React Native playground app, and am now trying to get BabylonReactNative to work in a fresh new React Native project to understand how much set-up I have to do.
I ran into this issue first: Can't build app on android · Issue #212 · BabylonJS/BabylonReactNative · GitHub
But could solve that thanks to the solution/workaround provided by that person.
Right now I’m getting:

error: Error: Unable to resolve module ./buffer from /Users/PathToBabylon/BabylonProject/node_modules/@babylonjs/core/Meshes/index.js:
None of these files exist:
* node_modules/@babylonjs/core/Meshes/buffer(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
* node_modules/@babylonjs/core/Meshes/buffer/index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
> 1 | export * from “./abstractMesh”;
2 | export * from “./Compression/index”;
3 | export * from “./csg”;
4 | export * from “./geometry”;

Could it be that there’s a buffer folder missing in @babylonjs/core?

I couldn’t really find any directions on how to import babylon in a project from scratch, so I’ve just npm installed @babylon/react-native, @babylon/core and @babylon/loaders into my project

This is how they’re defined in the package.json:

"@babylonjs/core": "^5.0.0-alpha.22",
"@babylonjs/loaders": "^4.2.0",
"@babylonjs/react-native": "^0.4.0-alpha.17",

Am I forgetting to add something? Or is this a bug?

Adding @ryantrem

I would try two things, in this order:

  1. Make sure your @babylonjs/core and @babylonjs/loaders have matching versions (e.g. npm install @babylonjs/loaders@5.0.0-alpha.22).
  2. Clear your npm cache via npm start -- --reset-cache (the extra -- is intentional).

@HedwigAR It moved from 4.2->5.0. I had the same issue recently:
Solved: NPM linking error - Questions - Babylon.js (babylonjs.com)

The only other one that moved that I had found was FluentMaterial :slight_smile: HTH

2 Likes

Thanks both! That was it, I didn’t know the two package versions were connected. I got it all up and running :smiley:

2 Likes