React-native-navigation: Error when using v2.0

Created on 9 Feb 2018  路  9Comments  路  Source: wix/react-native-navigation

My dependencies:
{
"react": "16.2.0",
"react-native": "0.53.0",
"react-native-navigation": "^2.0.2121"
},

error: bundling failed: Error: While trying to resolve module react-native-navigation from file /Users/hihihahahehe/Desktop/GlennDoman/App.js, the package /Users/hihihahahehe/Desktop/GlennDoman/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/hihihahahehe/Desktop/GlennDoman/node_modules/react-native-navigation/lib/dist/index.js. Indeed, none of these files exist:

Most helpful comment

Then try this (in the terminal):

1.npm install -g typescript

  1. then go to the directory of your app
  2. cd node_modules/react-native-navigation
  3. type "tsc" (without "")
  4. run app as usual

That should do it?

All 9 comments

How do you import RNN in your app?
It used to be import Navigation from 'react-native-navigation' but nowadays it's import { Navigation } from 'react-native-navigation'

aw, i'm following Usage in Documents:
import Navigation from 'react-native-navigation';

Let's i try again

@billyohgren i'm still got this error :"(

Then try this (in the terminal):

1.npm install -g typescript

  1. then go to the directory of your app
  2. cd node_modules/react-native-navigation
  3. type "tsc" (without "")
  4. run app as usual

That should do it?

@billyohgren Thank you it is so useful 馃憤

Glad I could help!
I made a quick update to the documentation as well https://github.com/wix/react-native-navigation/pull/2691

I am new to React and React Native, but getting the same error as above.

Obviously I'm missing some dependency or something - but what? And how do I fix it?

When I run the tsc command from the node_modules/reative-native-navigation folder it get hundreds of errors starting with:

error TS2688: Cannot find type definition file for 'jest'.

error TS2688: Cannot find type definition file for 'lodash'.

error TS2688: Cannot find type definition file for 'react'.

error TS2688: Cannot find type definition file for 'react-native'.

error TS2688: Cannot find type definition file for 'react-test-renderer'.

lib/src/adapters/Element.tsx:20:28 - error TS2339: Property 'props' does not exist on type 'Element'.

20       <RNNElement {...this.props} />
                              ~~~~~

Hi @kgomara and 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.

Hi @edgarbonillag it still doesn't work

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zhanguangao picture zhanguangao  路  3Comments

swingywc picture swingywc  路  3Comments

yedidyak picture yedidyak  路  3Comments

birkir picture birkir  路  3Comments

EliSadaka picture EliSadaka  路  3Comments