Chepe77 Chepe77 - 2 months ago 18
React JSX Question

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

Answer

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

Comments