Jose Llausas
Jose Llausas

Reputation: 3406

Unable to require Parse in react-native. 'Requiring unknown module "react-native"'

I have the following installed with npm:

"dependencies": {
    "parse": "^1.9.1",
    "react-native": "0.32.0",
    "react-native-admob": "^1.1.5",
    "react-redux": "4.4.5",
    "redux": "3.5.2"
  },

I am unable to require Parse into my react-native app by using: var Parse = require('parse/react-native')

I get this error:

enter image description here

The file react-native IS inside node_modules/parse/react_native.js but my app wont find it. I have tried reseting the emulator, deleting and reinstalling node_modules.

The error is now a know issue: Issue

Upvotes: 2

Views: 903

Answers (1)

Jose Llausas
Jose Llausas

Reputation: 3406

Solution:

Inside file node_modules/parse/lib/react-native/StorageController.react-native.js change this line:

var _reactNative = require('react-native');

to

var _reactNative = require('../../../react-native');

This is still an open issue in github:

This solution was found by @jaredwitt In:

https://github.com/ParsePlatform/Parse-SDK-JS/issues/342

I was able to patch it by changing the following line in node_modules/parse/lib/react-native/StorageController.react-native.js

Upvotes: 2

Related Questions