Nozbe / WatermelonDB

🍉 Reactive & asynchronous database for powerful React and React Native apps ⚡️
https://watermelondb.dev
MIT License
10.49k stars 589 forks source link

Installation Issue - Babel #121

Closed rafaelcamaram closed 5 years ago

rafaelcamaram commented 5 years ago

I'm trying to use WatermelonDB on my project but, as I could see, I'm facing with some dependencies issues that are not allowing me to run the project.

I followed all the instructions gave at INSTALLATION GUIDE but the below error is displayed when the application is being open on my device.

Dependencies:

"dependencies": {
    "@mapbox/react-native-mapbox-gl": "^6.1.3",
    "@nozbe/watermelondb": "^0.6.2",
    "lodash": "^4.17.11",
    "next-frame": "^0.2.3",
    "react": "16.3.1",
    "react-native": "~0.55.2",
    "react-native-image-zoom-viewer": "^2.2.15",
    "react-native-maps": "^0.21.0",
    "react-native-snap-carousel": "^3.7.2",
    "react-native-splash-screen": "^3.1.1",
    "react-navigation": "^2.11.2",
    "react-redux": "^5.0.7",
    "realm": "^2.18.0",
    "redux": "^4.0.0",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0",
    "rn-fetch-blob": "^0.10.12",
    "styled-components": "^3.4.2"
  },
  "devDependencies": {
    "@babel/core": "^7.1.2",
    "@babel/plugin-proposal-decorators": "^7.1.2",
    "@babel/polyfill": "^7.0.0",
    "@babel/preset-env": "^7.1.0",
    "@babel/preset-stage-3": "^7.0.0",
    "chai": "^4.1.2",
    "fetch-mock": "^6.5.2",
    "jest": "^23.5.0",
    "jest-react-native": "^18.0.0",
    "metro-react-native-babel-preset": "^0.48.2",
    "mocha": "^5.2.0",
    "react-test-renderer": "16.3.1",
    "redux-mock-store": "^1.5.3",
    "sinon": "^6.1.5"
  },

Error:

error: bundling failed: Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel.
    at throwVersionError (/Users/my-name/Documents/projects/company/project-name/node_modules/@babel/helper-plugin-utils/lib/index.js:65:11)
    at Object.assertVersion (/Users/my-name/Documents/projects/company/project-name/node_modules/@babel/helper-plugin-utils/lib/index.js:13:11)
    at _default (/Users/my-name/Documents/projects/company/project-name/node_modules/@babel/plugin-proposal-decorators/lib/index.js:35:7)
    at /Users/my-name/Documents/projects/company/project-name/node_modules/@babel/helper-plugin-utils/lib/index.js:19:12
    at Function.memoisePluginContainer (/Users/my-name/Documents/projects/company/project-name/node_modules/babel-core/lib/transformation/file/options/option-manager.js:113:13)
    at Function.normalisePlugin (/Users/my-name/Documents/projects/company/project-name/node_modules/babel-core/lib/transformation/file/options/option-manager.js:146:32)
    at /Users/my-name/Documents/projects/company/project-name/node_modules/babel-core/lib/transformation/file/options/option-manager.js:184:30
    at Array.map (<anonymous>)
    at Function.normalisePlugins (/Users/my-name/Documents/projects/company/project-name/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (/Users/my-name/Documents/projects/company/project-name/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
    at OptionManager.init (/Users/my-name/Documents/projects/company/project-name/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at File.initOptions (/Users/my-name/Documents/projects/company/project-name/node_modules/babel-core/lib/transformation/file/index.js:212:65)
    at new File (/Users/my-name/Documents/projects/company/project-name/node_modules/babel-core/lib/transformation/file/index.js:135:24)
    at Pipeline.transform (/Users/my-name/Documents/projects/company/project-name/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at Object.transform (/Users/my-name/Documents/projects/company/project-name/node_modules/metro/src/transformer.js:135:5)
    at Object.transformCode [as transform] (/Users/my-name/Documents/projects/company/project-name/node_modules/metro/src/JSTransformer/worker/index.js:253:15)
    at execMethod (/Users/my-name/Documents/projects/company/project-name/node_modules/jest-worker/build/child.js:92:29)
    at process.on (/Users/my-name/Documents/projects/company/project-name/node_modules/jest-worker/build/child.js:42:7)
    at emitTwo (events.js:126:13)
    at process.emit (events.js:214:7)
    at emit (internal/child_process.js:762:12)
    at _combinedTickCallback (internal/process/next_tick.js:142:11)
radex commented 5 years ago

I don't see how this is related to Watermelon… Did you go through all the standard troubleshooting steps to restart packager, etc? At which point did the build break? When you added watermelon package? Did you add any other packages?

rafaelcamaram commented 5 years ago

I just realized that the React Native (0.55) package was requiring the version 6.26.3 of babel-core then it was breaking the application and triggering the error that I reported.

But when I updated my package.json to use these versions, everything started to work :)

"react": "16.6.0-alpha.8af6728",
"react-native": "0.57.3",

Anyway, thanks for the response :)