Skip to content

Error setting up sample project from scratch #456

Closed
@kbhokray

Description

@kbhokray

When I try to setup the sample repo from scratch, the project crashes on start with the below error when setup with [email protected] and @babylonjs/react-native-iosandroid-0-65 on Android. I have checked on emulators Pixel 2 API 29 and Pixel XL API 31. Cloning the sample repo and running it directly works without a problem. But when I remove package-lock.json and run, it starts breaking again

Error:

Unexpected token '='
no stack

Android error stack:

2022-09-08 14:40:56.471 17190-17307/com.babylon65 E/unknown:ReactNative: Exception in native call from JS
    com.facebook.react.devsupport.JSException: Unexpected token '='
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
        at android.os.Looper.loop(Looper.java:214)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: com.facebook.jni.CppException: Unexpected token '='
    
    no stack
    	... 7 more

To Reproduce
Follow the setup steps in the sample repo

> react-native init babylon65 --version 0.65
> cd babylon65
> npm i --save @babylonjs/react-native @babylonjs/react-native-iosandroid-0-65 @babylonjs/core @babylonjs/loaders [email protected]
> npm install -D typescript @types/jest @types/react @types/react-native @types/react-test-renderer
> vi tsconfig.json #Copy the config from the repo
> vi jest.config.js #Copy the config from the repo
> mv App.js App.tsx
> vi App.tsx #Copy App.tsx from [the repo](https://github.com/BabylonJS/BabylonReactNativeSample/blob/main/App.tsx)
> npm start
> npm run android

Alternatively, following the below steps also gives the same error

git clone https://github.com/BabylonJS/BabylonReactNativeSample.git
cd BabylonReactNativeSample
rm package-lock.json
npm install
npm start
npm run android

Repo with the error-ing package-lock.json for reference:

git clone https://github.com/kbhokray/babylon65
npm install
npm start
npm run android

Expected behavior
The application should run without an error

Screenshots
babylon65_error

Other

  • Platform: Android
  • nodejs v16.17.0 (also checked with v14.17.0)

Since it looks like it's a babel error, I also tried adding the below in babel.config.js as mentioned in babel's repo. Even that doesn't seem to work

module.exports = {
   presets: [['module:metro-react-native-babel-preset', {
        unstable_disableES6Transforms: true
    }]],
};

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions