react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

[v2] Building

Open jeprojects opened this issue 8 years ago • 10 comments

Issue Description

Following the instructions here: https://wix.github.io/react-native-navigation/v2/#/docs/installation-android

I am getting this error:

ANDROID

FAILURE: Build failed with an exception.

  • Where: Script '/Users/xxx/Documents/ReactNative/xxx/xxx/node_modules/react-native-navigation/lib/android/prepare-robolectric.gradle' line: 6

  • What went wrong: A problem occurred evaluating script.

Could not find method testImplementation() for arguments [org.khronos:opengl-api:gl1.1-android-2.1_r1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

iOS

error: bundling failed: Error: While trying to resolve module react-native-navigation from file /Users/xxx/Documents/ReactNative/xxx/xxx/app/app.js, the package /Users/xxx/Documents/ReactNative/xxx/xxx/node_modules/react-native-navigation/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (/Users/xxx/Documents/ReactNative/xxx/xxx/node_modules/react-native-navigation/lib/dist/index.js. Indeed, none of these files exist:

I looked and /dist doesn't exist, but /src does in the RNN node_modules directory.

Steps to Reproduce / Code Snippets / Screenshots

Fresh install of latest React Native, and follow these instructions: https://wix.github.io/react-native-navigation/v2/#/docs/installation-android


Environment

  • React Native Navigation version: 2.0.2121
  • React Native version: 0.53.0
  • Platform(s) (iOS, Android, or both?): Android doesn't build / iOS doesn't start
  • Device info (Simulator/Device? OS version? Debug/Release?): Simulator

jeprojects avatar Feb 10 '18 10:02 jeprojects

This solution worked for me #2688

FlaviooLima avatar Feb 10 '18 13:02 FlaviooLima

For the iOS issue: From node_modules/react-native-navigation directory: type "npm run build"

yogeverez avatar Feb 10 '18 13:02 yogeverez

@FlaviooLima You suggestion didn't work for both Android and iOS.

@yogeverez Thanks, that did work for iOS :)

Now just the Android to solve. At least I can continue building the app now.

jeprojects avatar Feb 10 '18 14:02 jeprojects

ran npm run build in node_modules/react-native-navigation dir Getting the below:

react-native-navigation git:(master) ✗ npm run build

> [email protected] build /Users/kumarpatel/Projects/NativeNavigation/node_modules/react-native-navigation
> rm -rf ./lib/dist && tsc

../@types/node/index.d.ts:139:13 - error TS2300: Duplicate identifier 'require'.

139 declare var require: NodeRequire;
                ~~~~~~~


../@types/react-native/index.d.ts:8584:14 - error TS2300: Duplicate identifier 'require'.

8584     function require(name: string): any;
                  ~~~~~~~


Files:           382
Lines:         66593
Nodes:        280732
Identifiers:   97949
Symbols:      137161
Types:         36217
Memory used: 146230K
I/O read:      0.10s
I/O write:     0.00s
Parse time:    0.86s
Bind time:     0.34s
Check time:    1.82s
Emit time:     0.00s
Total time:    3.02s
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `rm -rf ./lib/dist && tsc`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/kumarpatel/.npm/_logs/2018-02-10T20_28_28_487Z-debug.log

Update Feb 11: npm version 5.6.0 Also tried it with newer RNN version: 2.0.2124

kumarpatel avatar Feb 10 '18 20:02 kumarpatel

@kumarpatel I didn't get that error at all and have no idea what it means. What npm version are you running? I hear you need npm 3+ for RNN. Might not fix the issue, but worth a check.

jeprojects avatar Feb 11 '18 05:02 jeprojects

There was a bug in the release step, fixed in https://github.com/wix/react-native-navigation/commit/f15f5dae7c353858fa8adb3f84fb3031f71632fe

DanielZlotin avatar Feb 11 '18 17:02 DanielZlotin

@DanielZlotin This patch looks like it fixes the issue with iOS but not the Android issue I was having.

jeprojects avatar Feb 11 '18 17:02 jeprojects

Seems like multiple issues were reported here. If there are still issues, please open separate issue. Thanks.

guyca avatar Feb 13 '18 16:02 guyca

For those who forked this project and couldn't get /lib/dist folder after npm install with your main project (like me :D)

I could generate /lib/dist folder by adding "prepare": "npm run build" to scripts in package.json (it works with npm version 5 or later)

masako-yamada avatar Jan 22 '19 23:01 masako-yamada

Hi Everyone,

What worked for me was this:

  1. npm uninstall react-native-navigation
  2. npm install -g typescript
  3. npm install --save react-native-navigation

It is important to mention that react-native-navigation is written in typescript and the npm run build form the react-native-navigation directory executes s a tsc command which is from typescript. For some reason if i had react-native-navigation already installed, and then installed the typescript module, and then exceuted npm run build, i got lots of errors. Running this command should generate a dist folder inside lib.

But, when i installed react-native-navigation after the typescript module was installed, it was installed perfectly and even the dist folder was already generated during the installation, so i didn't even have to go there and run npm run build.

edgarbonillag avatar Feb 21 '19 06:02 edgarbonillag