question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compile error: Unknown option: .pre with react-native-reanimated/plugin

See original GitHub issue

Description

Since I installed react-native-reanimated, my application won’t start. I tried several versions of react-native or Babel, but nothing works.

error: index.js: [BABEL] W:\folders\project\index.js: Unknown option: .pre. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.

Expected behavior

When I add the react-native-reanimated/plugin plugin in the babel.config.js file, my application doesn’t want to run anymore.

Actual behavior & steps to reproduce

  1. Run: npx react-native init MyApp --template @ui-kitten/template-ts.
  2. Run: npm install react-native-reanimated.
  3. Add babel plugin to babel.config.js.
  4. Change enableHermes to true.
  5. Change MainApplication.java.
  6. Run: react-native run-android or with --reset-cache.

Snack or minimal code example

babel.config.js

module.exports = {
  presets: [
    'module:metro-react-native-babel-preset',
    'react-native-reanimated/plugin',
  ],
};

index.js

import { AppRegistry } from 'react-native';
import { name as appName } from './app.json';
import App from './src/App';

AppRegistry.registerComponent(appName, () => App);

App.tsx (I already tried to remove all routes and imports)

...
import 'react-native-gesture-handler';

export default (): React.ReactFragment => {
  return (
    <>
      <IconRegistry icons={EvaIconsPack} />
      <ApplicationProvider {...eva}>
        <NavigationContainer>
          <RootStack.Navigator screenOptions={screenOptions}>
            <RootStack.Screen name="Home" component={HomeScreen} />
            <RootStack.Screen name="Editor" component={EditorScreen} />
          </RootStack.Navigator>
        </NavigationContainer>
      </ApplicationProvider>
    </>
  );
};

Package versions

  • React Native: 0.66.3
  • React Native Reanimated: 2.3.0-beta.4
  • NodeJS: 16.8.0
  • Xcode: None
  • Java & Gradle: Java 8 & Gradle 6.8

Affected platforms

  • Android
  • iOS
  • Web

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

6reactions
ablausecommented, May 6, 2022

I put react-native-reanimated/plugin in "presets", instead in "plugins". Check if you haven’t done the same.

0reactions
Luetoncommented, Aug 7, 2022

I put react-native-reanimated/plugin in "presets", instead in "plugins". Check if you haven’t done the same.

im glad you made this mistake, same here 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compilation error with react-native-reanimated and babel
js: [BABEL] W:\folders\project\index.js: Unknown option: .pre. Check out https://babeljs.io/ ...
Read more >
Installation | React Native Reanimated - Software Mansion
After adding the react-native-reanimated/plugin to your project you may encounter a false-positive "Reanimated 2 failed to create a worklet" error.
Read more >
Package babel Error: Unknown option `francais' - TeX
The complete error message is: ! Package babel Error: Unknown option `francais'. Either you misspelled it (babel) or the language definition ...
Read more >
Module build failed: ReferenceError [BABEL] Unknown option
gulp does not work: Module build failed: ReferenceError [BABEL] Unknown option: direct.presets. We use Laravel 5.3.x and have elixir for build assets.
Read more >
Invalid ProGuard configuration file. Unknown option '-if' in line 16
Unknown option '-if' in line 16. Hi ,. I am new to Xamarin Development. While i build xamarin application i get the following...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found