Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error setting up sample project from scratch #456

Closed
kbhokray opened this issue Sep 9, 2022 · 3 comments
Closed

Error setting up sample project from scratch #456

kbhokray opened this issue Sep 9, 2022 · 3 comments
Assignees
Milestone

Comments

@kbhokray
Copy link

kbhokray commented Sep 9, 2022

When I try to setup the sample repo from scratch, the project crashes on start with the below error when setup with react-native@0.65.2 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 react-native-permissions@3.0.0
> 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
    }]],
};
@antonyrey
Copy link

Hello,

I have exactly the same issue here.

Having trouble using react-babylonjs as well with BabylonReactNative.

Thank you, have a nice day.

@thomlucc thomlucc added the 6.0 label Sep 23, 2022
@thomlucc thomlucc added this to the 6.0 milestone Sep 23, 2022
@thomlucc thomlucc removed the 6.0 label Sep 23, 2022
@kbhokray
Copy link
Author

Some activity on this happening at BabylonJS/BabylonReactNativeSample#9 (comment)

@kbhokray
Copy link
Author

Looks like this is being tracked here: #469. Closing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants