0

I am trying to compile a 'kitchen-sink' demo, for 'react-native':

NativeBase-KitchenSink

, and I have followed the following links already:

Solution to "React native: Android project not found. Maybe run react-native android first?"

Solution to "Expo : Cannot find a module LogReporter"

That is, from the installation of 'npm' till the installation of required tools using 'Yarn'.

And now I am stuck myself:

a. I run the command npm install in the 'root directory' of this project.

b. Then I run expo start, I see that the problems addressed in link 1 and 2 have gone away.

c. Then when the browser is up, I issue expo build:android

The following error shows up:

[11:14:44] Checking if current build exists...
[11:14:48] No currently active or previous builds for this project.
[11:14:50] Publishing to channel 'default'...
[11:14:56] Building iOS bundle
[11:15:09] Building Android bundle
[11:15:20] Analyzing assets
[11:15:27] Uploading assets
[11:15:27] No assets to upload, skipped.
[11:15:27] Processing asset bundle patterns:
[11:15:27] - D:\Projects\ReactNativeProjects\AwesomeProject\**\*
[11:15:27] Cannot read property 'forEach' of undefined
[11:15:27] TypeError: Cannot read property 'forEach' of undefined
at C:\xdl@51.4.0\src\Project.js:903:26
at Generator.next (<anonymous>)
at step (C:\Users\hp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\Project.js:2033:191)
at C:\Users\hp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\Project.js:2033:361

Please help me know where I am wrong? Some posts say the code is correct.

[EDIT]:

I also did a new thing in my 'app.json', just before executing command react-native eject, to create Android and iOS folders:

(Note: It is not mandatory to issue the react-native eject command, as this will cause permanent change according to the documentations)

{
  "expo": {
    "name": "AwesomeProject",
    "description": "A Kitchen Sink project.",
    "slug": "AwesomeProject",
    "privacy": "public",
    "sdkVersion": "30.0.0",
    "platforms": [
      "ios",
      "android"
    ],
    "ios": {
      "supportsTablet": true
    },
    "android": {
      "package": "com.abhsax.first"
    },
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/logo.png",
    "splash": {
      "image": "./assets/splashscreen.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ]
  },
"changes": "----below are the changes----",
  "name": "AwesomeProject",
  "displayName": "AwesomeProject"
}

That is, just when I added:

"name": "AwesomeProject",
 "displayName": "AwesomeProject"

at the bottom of my 'app.json'

the command react-native eject started working, which was not working earlier, as the output was:

App name must be defined in the app.json config file to define the project name. It must not contain any spaces or dashes.

Clearly, it is the hybrid of two different versions of the package managers: 'Expo' and 'npm'.

But the 'forEach' error in the concern here, did not go away.

Further efforts done were useless, so I am not putting them here.

I shall keep on trying until I figure it out.

Abhinav Saxena
  • 1,990
  • 2
  • 24
  • 55

3 Answers3

1

you have to upgrade the expo cli version do npm install -g expo-cli and then expo start again

Nikhil bhatia
  • 1,297
  • 1
  • 8
  • 9
0

I resolved this by knowing that I was again mixing up with the package managers: 'npm' and 'yarn', and this time you do not need 'expo' for time being or all-together, so modify your 'app.json', removing expo section.

All I had to do was to issue the following commands in order.

  1. Add React Base

yarn add react-base --save

  1. Install Peer Dependencies

The peer dependencies included from any 'npm' packages does not automatically get installed. Your application will not depend on it explicitly.

react-native link

In the case of this demo project, one dependency was missing:

react-native link react-native-vector-icons

  1. Start Yarn

yarn start

  1. Run on android device or simulator.

react-native run-android

[Note:] Java 8 is recommended to be installed instead of higher versions of Java. see: What to install? Java 8 or Java 10

I wish it helps.

Happy coding :-)

Abhinav Saxena
  • 1,990
  • 2
  • 24
  • 55
  • You can use the same Java version that is shipped with Android Studio. Just make sure that your System Environment Variables point to its bin and root folder paths respectively. – Abhinav Saxena Feb 27 '19 at 07:51
0

Try changing:
"assetBundlePatterns": ["**/*"] to "assetBundlePatterns": ["assets/*"]
in your app.json file.

iku
  • 133
  • 2
  • 9