2

I am creating project in react native for android and tried to install native-base using the following command npm install native-base --save. After that when I am linking the library using react-native link I am getting error as follow.

rnpm-install ERR! ERRPACKAGEJSON No package found. Are you sure this is a React Native project?

Cannot read property '_text' of undefined

TypeError: Cannot read property '_text' of undefined
    at SAXParser.parser_text [as ontext] (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/xmldoc/lib/xmldoc.js:235:39)
    at emit (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/xmldoc/node_modules/sax/lib/sax.js:639:35)
    at closeText (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/xmldoc/node_modules/sax/lib/sax.js:649:26)
    at emitNode (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/xmldoc/node_modules/sax/lib/sax.js:643:26)
    at SAXParser.write (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/xmldoc/node_modules/sax/lib/sax.js:1195:15)
    at new XmlDocument (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/xmldoc/lib/xmldoc.js:199:15)
    at readManifest (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/react-native/local-cli/core/android/readManifest.js:20:10)
    at Object.projectConfigAndroid [as projectConfig] (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/react-native/local-cli/core/android/index.js:41:20)
    at Object.keys.forEach.key (/home/codism-8/NewReactWorkSpace/NamazTiming/node_modules/react-native/local-cli/core/index.js:101:36)
    at Array.forEach (<anonymous>)

I followed this documentation http://docs.nativebase.io/docs/GetStarted.html. I am not getting what is the problem. Please help

Package.json

"dependencies": {
    "native-base": "^2.12.0",
    "react": "16.6.3",
    "react-native": "^0.57.7",
    "react-native-flash-message": "^0.1.10",
    "react-native-linear-gradient": "^2.5.3",
    "react-native-modal-datetime-picker": "^6.0.0",
    "react-native-navigation": "^2.8.0",
    "react-native-tab-view": "^1.3.2",
    "react-native-vector-icons": "^6.2.0",
    "react-redux": "^6.0.1",
    "redux": "^4.0.1",
    "redux-thunk": "^2.3.0"
  },

enter image description here

8
  • Are you sure you are running the command in the correct folder, because the link command is unable to find your package.json? Commented Mar 5, 2019 at 8:46
  • yes I am in the correct folder Commented Mar 5, 2019 at 8:47
  • please help bro what is the problem Commented Mar 5, 2019 at 8:50
  • share your project exiting path, your node server screenshot and if possible also share your react-native and native-based version in your question.In which Directory you have fire react-native link command? Commented Mar 5, 2019 at 9:02
  • Sorry for late see the updated one Commented Mar 5, 2019 at 10:02

4 Answers 4

3

1-Make sure you've done the npm install native-base --save in the project directory

2- Try npm i to fix the problems with dependencies, then commandreact-native run-android to make sure your dependencies and "node_modules" folder work properly and project can run.

If you don't have 'android' or 'ios' folder you can use command react-native eject, then link the packages.

3- Write the command react-native link native-base, this command links exactly native-base package with react native.
However I recommend you to mostly link the packages manually.

You can also try previous version of native base, like v 2.10.0.

Sign up to request clarification or add additional context in comments.

9 Comments

the app is working properly after react -native run-android
did you link with command react-native link native-base or react-native link? are you using react-native or expo?
yes, I tried react-native link native-base got same error and I am using react-native. Where is the problem
try uninstalling the package and installing previous versions of native base, like 2.10.0 which is a more tested version.
the problem is with _text. Did you make a folder or dependencies configuration named _text or like that? If yes, delete it.
|
1

Thank you @AmirGorji @parashKorat for helping me. For me, this problem was coming because I have removed android:roundIcon="@mipmap/ic_launcher_round" from the manifest file. When I put it again the react-native link is working. I removed it because after adding my icons it was showing the error of missing a round icon, for temporary I removed that.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.namaztiming">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

</manifest>

I don't know is it a proper solution or not but in my case, it solved the problem.

Comments

0

I faced this issue today and what I did was ran these commands to clean the gradle for the project.

1- Go to the root directory of the project.

2- Run cd android

3- Run gradlew clean

4- Run cd..

and then run the link commands

Comments

0

Since react 0.69 linking is not working. The alternative is to install react-native-assets, but this gives me errors with react-native 0.69.4. So I decided to install manually.

For iOS:

Step 1 : Add/Remove fonts to “Resources” folder in xcode project

enter image description here

Note : Just Drag the fonts in xcode “Resources” folder and check “Copy items if needed” . Add to target should be your project.

if files are copied correctly you can see the files in “Copy bundle resources” in “Build phases” tab

enter image description here

Step 2 : Add/Remove fonts in info.plist files in xcode project with key “Fonts provided by application”

enter image description here

For Android:

Step 1 : Add/Remove fonts to android project in following directory

android/app/src/main/assets/

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.