facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.88k stars 24.3k forks source link

RCTExceptionsManager.reportFatalException was called with 2 arguments, but expects 3 #3249

Closed JeanLebrument closed 9 years ago

JeanLebrument commented 9 years ago

Hello,

I'm working on a React-Native project using react-native-webpack-server. When I run npm run start I have these errors:

Unable to resolve module ./base64-vlq from /Users/jeanlebrument/Documents/Developments/project-clients/node_modules/react-native-router/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./util from /Users/jeanlebrument/Documents/Developments/project-clients/node_modules/react-native-router/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./array-set from /Users/jeanlebrument/Documents/Developments/project-clients/node_modules/react-native-router/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./base64 from /Users/jeanlebrument/Documents/Developments/project-clients/node_modules/react-native-router/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./util from /Users/jeanlebrument/Documents/Developments/project-clients/node_modules/react-native-router/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./util from /Users/jeanlebrument/Documents/Developments/project-clients/node_modules/react-native-router/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./binary-search from /Users/jeanlebrument/Documents/Developments/project-clients/node_modules/react-native-router/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./array-set from /Users/jeanlebrument/Documents/Developments/project-clients/node_modules/react-native-router/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./base64-vlq from /Users/jeanlebrument/Documents/Developments/project-clients/node_modules/react-native-router/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./source-map-generator from /Users/jeanlebrument/Documents/Developments/project-clients/node_modules/react-native-router/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module ./util from /Users/jeanlebrument/Documents/Developments/project-clients/node_modules/react-native-router/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module source-map/source-map-consumer from /Users/jeanlebrument/Documents/Developments/project-clients/node_modules/react-native-router/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module source-map/source-map-generator from /Users/jeanlebrument/Documents/Developments/project-clients/node_modules/react-native-router/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js
Unable to resolve module source-map/source-node from /Users/jeanlebrument/Documents/Developments/project-clients/node_modules/react-native-router/node_modules/react-native/Libraries/JavaScriptAppEngine/Initialization/SourceMap.js

Then when I launch an iOS simulator I have these errors:

Warning: EventPluginUtils.injection.injectMount(...): Injected Mount module is missing getNode or getID.

Error: ReactNativeComponent.injection.injectAutoWrapper is not a function
 stack: 
  Object.inject  index.ios.bundle:5176
  <unknown>      index.ios.bundle:1549
  require        index.ios.bundle:254
  <unknown>      index.ios.bundle:1517
  require        index.ios.bundle:254
  <unknown>      index.ios.bundle:1416
  require        index.ios.bundle:254
  <unknown>      index.ios.bundle:1395
  require        index.ios.bundle:254
  require        index.ios.bundle:200
 URL: undefined
 line: undefined
 message: ReactNativeComponent.injection.injectAutoWrapper is not a function

Here are the webpack config file and package.json:

// WEBPACK CONFIG
var fs = require('fs');
var path = require('path');
var webpack = require('webpack');

var config = {

  debug: true,

  devtool: 'source-map',

  entry: {
    'index.ios': ['./javascript/ios.js'],
  },

  output: {
    path: path.resolve(__dirname, 'build'),
    filename: '[name].js',
  },

  module: {
    preLoaders: [{
      test: /\.js$/,
      exclude: /node_modules/,
      loader: "eslint-loader"
    }],
    loaders: [{
      test: /\.js$/,
      include: [
        path.resolve(__dirname, 'javascript'),
        path.resolve(__dirname, 'node_modules/react-native-router'),
        path.resolve(__dirname, 'node_modules/react-native-blur'),
        path.resolve(__dirname, 'node_modules/react-native-icons'),
        path.resolve(__dirname, 'node_modules/react-native-overlay'),
      ],
      loader: "babel-loader",
      query: {
        stage: 0,
        plugins: [],
        blacklist: "validation.react",
      }
    }]
  },

  plugins: [],

};

// Hot loader
if (process.env.HOT) {
  config.devtool = 'eval'; // Speed up incremental builds
  config.entry['index.ios'].unshift('react-native-webpack-server/hot/entry');
  config.entry['index.ios'].unshift('webpack/hot/only-dev-server');
  config.entry['index.ios'].unshift('webpack-dev-server/client?http://localhost:8082');
  config.output.publicPath = 'http://localhost:8082/';
  config.plugins.unshift(new webpack.HotModuleReplacementPlugin());
  config.module.loaders[0].query.plugins.push('react-transform');
  config.module.loaders[0].query.extra = {
    'react-transform': {
      transforms: [{
        transform: 'react-transform-hmr',
        imports: ['react-native'],
        locals: ['module']
      }]
    }
  };
}

// Production config
if (process.env.NODE_ENV === 'production') {
  config.plugins.push(new webpack.optimize.OccurrenceOrderPlugin());
  config.plugins.push(new webpack.optimize.UglifyJsPlugin());
}

module.exports = config;
// PACKAGE.JSON
{
  "name": "ReactNativeFluxBoilerplate",
  "version": "0.0.1",
  "description": "React native boilerplate with Flux, React native webpack and hot reload",
  "keywords": [
    "react native",
    "flux",
    "webpack",
    "hot reload"
  ],
  "homepage": "https://github.com/OssamaZ/react-native-flux-boilerplate",
  "private": true,
  "scripts": {
    "start": "./node_modules/.bin/react-native-webpack-server start",
    "hot": "HOT=1 ./node_modules/.bin/react-native-webpack-server start --hot"
  },
  "dependencies": {
    "react-native": "^0.11.0",
    "react-native-router": "^0.2.1",
    "react-redux": "^3.0.0",
    "redux": "^3.0.2"
  },
  "devDependencies": {
    "babel-core": "^5.8.24",
    "babel-eslint": "^4.1.3",
    "babel-loader": "^5.3.2",
    "babel-plugin-react-transform": "^1.1.1",
    "eslint": "^1.6.0",
    "eslint-config-airbnb": "^0.1.0",
    "eslint-loader": "^1.0.0",
    "eslint-plugin-react": "^3.5.1",
    "events": "^1.0.2",
    "flux": "^2.1.1",
    "keymirror": "^0.1.1",
    "lodash": "^3.10.1",
    "react": "^0.13.3",
    "react-hot-loader": "^1.3.0",
    "react-native-webpack-server": "^0.6.0",
    "react-transform-hmr": "^1.0.1",
    "redux-devtools": "^2.1.5",
    "webpack": "^1.12.2",
    "webpack-dev-server": "^1.11.0"
  }
}

I tried rm -rf node_modules && npm i but it didn't solve my problem.

Any idea?

Best, Jean

ide commented 9 years ago

Could you check if your project works with the included packager? If so and the issue is related to the Webpack server, please open a new issue on the RN Webpack server project.

JeanLebrument commented 9 years ago

Hello @ide thanks for your answer.

After further researches, I found out that it was due to one package that I use on my project which requires an old version of React-Native.

I removed the react-native's dependency inside this package and now it works.