Last Updated
Viewed 15 Times

Is there a way to include node_modules in aar library so that a new android project using this aar library doesn't have to add these dependencies at their end as well?

I wanted to create a react native project which could be integrated in an existing android project as an aar library. Since I couldn't find a way to create an aar library of a react native project, I followed https://facebook.github.io/react-native/docs/integration-with-existing-apps to integrate react native in android app and then create an aar library of it. I managed to do it but the aar file created this way is of very small size (since it doesn't contain node_modules I suppose). So now to use this aar in a fresh android project, I had to install all the node_modules there as well and then specify the path in project's build.gradle like maven { url "$rootDir/node_modules/react-native/android" }

Is there a way that this step is not required at the end of the app that is going to integrate the aar? Besides please correct me if I took a wrong approach somewhere and is there an alternative way to approach this.

I am serving "react-native start" command in my project and it gives me below error.

Invalid regular expression: /(.\__fixtures__\.|node_modules[\]react[\]dist[\].|website\node_modules\.|heapCapture\bundle.js|.\__tests__\.)$/: Unterminated character class

I have found above problem solution here.

But the problem is when i am trying to navigate to "node_modules\metro-config\src\defaults\blacklist.js" this path there is no such folder named "metro-config".

I did remove the node_modules and re-install them again but the problem is still same.

In this case, I am requiring request-promise, but when I start the react native project, I get the error:

"Unable to resolve module x. If you are sure the module is there, try restarting the packager."

This error is reported for every dependency of the request dependency of request-promise. I have restarted the packager as well as removing node_modules and reinstalling. In general, what does this error stem from and in the specific, what can be done to solve it?

node v4.2.1, npm v2.14.7

I just started my project with the init command create-react-native-app and I installed all prerequires.

I have some problems with the command react-native run-android I got this error

Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee081Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore081Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco081Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline081Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp081Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0201Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).

I tried to search about it and people are talking about upgrading react-native but when I try to "react-native-git-upgrade" i got an error with version of my "package.json".

    git-upgrade info Check for updates 
git-upgrade info Read package.json files 
git-upgrade info Check declared version 
git-upgrade info Check matching versions 
git-upgrade ERR! An error occurred during upgrade: 
git-upgrade ERR! Error: react-native version in "package.json" (https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz) doesn't match the installed version in "node_modules" (0.55.4).
Try running "npm install" to fix this.
    at checkMatchingVersions (/usr/local/lib/node_modules/react-native-git-upgrade/checks.js:24:11)
    at Object.<anonymous> (/usr/local/lib/node_modules/react-native-git-upgrade/cliEntry.js:253:5)
    at Generator.next (<anonymous>)
    at step (/usr/local/lib/node_modules/react-native-git-upgrade/cliEntry.js:171:191)
    at /usr/local/lib/node_modules/react-native-git-upgrade/cliEntry.js:171:361
    at tryCallOne (/usr/local/lib/node_modules/react-native-git-upgrade/node_modules/promise/lib/core.js:37:12)
    at /usr/local/lib/node_modules/react-native-git-upgrade/node_modules/promise/lib/core.js:123:15
    at flush (/usr/local/lib/node_modules/react-native-git-upgrade/node_modules/asap/raw.js:50:29)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9) 

When I do npm install nothing change, I tried to delete my node_modules directory and create new one with npm install but it doesn't change.

I'm on Ubuntu and I'm struggling with this since few days ...

Similar Question 4 (1 solutions) : React Native : Native modules return nothing

Similar Question 5 (1 solutions) : Default node_modules in react native

Similar Question 6 (3 solutions) : Errors adding dependency with react-native

Similar Question 8 (2 solutions) : Typescript + Webpack + node_modules resolution

Similar Question 9 (1 solutions) : Android AAR library - bundle node_modules

cc