Need unknown module “Reactperf” when react native with existing Android applications

I am trying to integrate the latest React Native build, and I encountered an error. This is my project setting:

In the app’s build.gradle , I imported react-native 0.24.1:

dependencies {
...
compile'com.facebook.react:react-native: 0.24.1'
}

The build.gradle of the project points to React Native in the Git submodule:

allprojects {
repositories {
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$projectDir/. ./MyGitSubmodule/AwesomeProject/node_modules/react-native/android"
}
}
}

I have integrated as described in the documentation here and followed The description in the documentation here upgraded RN in the git submodule. I have uploaded my stack trace to this pastebin link. To summarize the stack trace, because formatting is difficult to read, these are the highlights:

> Unable to find the generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager-this works for a large number of Native classes. Maybe all of them.
>Error: Unknown module “ReactPerf” is required. If you are sure about the module There, please try to restart the packager or run “npm install”
>Get JS exception: Error: Request module “23” to raise exception
>Get JS exception: ReferenceError: Variable not found: __fbBatchedBridge< br>>In addition, the emulator displays a red death screen and shows Shows the following message-“Error: Module required “8”, it raised an exception”

Basically, It complains that the module ReactPerf is required, but it does not exist.

For reference only, ReactPerf module: https://www.npmjs.com/package/react-addons-perf.

p>

Logically, we just need to tell react-native to install this thing.

The tricky part is if we do:

npm install react- addons-perf, and then we install it “outside” the react-native dependency. Therefore, it will complain that react-addons-perf also needs the react package.

The solution is that we need to declare this dependency “Inside” react-native package. To put it another way:

Open node_modules / react-native / package.json. You will find

.. .
"dependencies": {
"absolute-path": "^0.0.0",
"art": "^0.10.0",
"babel-core ": "~6.4.5",
"babel-plugin-external-helpers": "~6.4.0",
...
"react": "^0.14.5 "
...
}

So, all we need to do is add react-addons-perf to these.

 ...
"dependencies": {
"absolute-path": "^0.0.0",
"art": "^0.10.0",
"babel -core": "~6.4.5",
"babel-plugin-external-helpers": "~6.4.0",
...
"react": "^0.14 .5",
"react-addons-perf": "^0.14.5", // ADD THIS LINE FOR ReactPerf module
...
}

Then, npm install.

According to my experience, the remaining errors, if needed Module “8” will also disappear.

It worked for me, hope it works for you too.

I am trying to integrate the latest React Native build , And I encountered an error. This is my project setting:

In the app’s build.gradle, I imported react-native 0.24.1:

p>

dependencies {
...
compile'com.facebook.react:react-native:0.24.1'
}

The build of the project. gradle points to React Native in the Git submodule:

allprojects {
repositories {
jcenter()
maven {
/ / All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$projectDir/../MyGitSubmodule/AwesomeProject/node_modules/react-native/android"
}< br /> }
}

I have integrated as described in the documentation here, and upgraded the RN in the git submodule as described in the documentation here. I have changed my stack The trace is uploaded to this pastebin link. To summarize the stack trace, because the formatting is difficult to read, these are the highlights:

>Cannot find the generated setter for the class com.facebook.react.views.text.ReactVirtualTextViewManager – This applies to a large number of Native classes. Maybe all of them. Error: Unknown module “ReactPerf” is required. If you are sure that the module is there, try restarting the packager or running “Npm install”
>Get JS exception: Error: Request module “23” to raise exception
>Get JS exception: ReferenceError: Variable not found: __fbBatchedBridge
>In addition, the simulator displays a red death screen , And displays the following message-“Error: Module required “8”, it throws an exception”

Basically, it complains that the module ReactPerf is required, but it Does not exist.

For reference only, ReactPerf module: https://www.npmjs.com/package/react-addons-perf.

Logically speaking, We just need to tell react-native to install this thing.

The tricky part is if we do:

npm install react-addons-perf, and then we install it in The “external” of the react-native dependency. Therefore, it will complain that react-addons-perf also needs the react package.

The solution is that we need to declare this dependency “inside” the react-native package. Change one A way of saying:

Open node_modules/react-native/package.json. You will find

...
"dependencies": {
"absolute-path": "^0.0.0",
"art": "^0.10.0",
"babel-core": "~6.4.5",< br />"babel-plugin-external-helpers": "~6.4.0",
...
"react": "^0.14.5"
...
}

So, all we need to do is add react-addons-perf to these.

...
"dependencies" : {
"absolute-path": "^0.0.0",
"art": "^0.10.0",
"babel-core": "~6.4.5" ,
"babel-plugin-external-helpers": "~6.4.0",
...
"react ": "^0.14.5",
"react-addons-perf": "^0.14.5", // ADD THIS LINE FOR ReactPerf module
...
}

Then install with npm.

According to my experience, the remaining errors, such as the module "8" will disappear if needed.

It is useful to me, I hope it Also suitable for you.

Leave a Comment

Your email address will not be published.