Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run the examples? #75

Closed
Steviey opened this issue Jan 29, 2017 · 18 comments · Fixed by #900
Closed

How to run the examples? #75

Steviey opened this issue Jan 29, 2017 · 18 comments · Fixed by #900

Comments

@Steviey
Copy link

Steviey commented Jan 29, 2017

As far as I know we have to first init a clean RN project and then add react-navigation via yarn or npm to the new project.

If I got it right, we then have to navigate in the new project folder to node_modules/react_navigation and do the steps described here:

https://github.com/react-community/react-navigation/tree/master/examples/NavigationPlayground

cd react-navigation
npm install
cd examples/NavigationPlayground
npm install
cd ../..
react-native start
cd examples/NavigationPlayground
react-native run-ios # ignore packager starting error
react-native run-android # ignore packager starting error

But if I do this, I get: 'Android project not found' even with two separate shells.

How do we run the examples on the correct way?

Am I the only one?

@thienanle
Copy link

I'm getting duplicate module errors when running react-native start.

Failed to build DependencyGraph: @providesModule naming collision:
  Duplicate module name: react-native-vector-icons

Any idea how to fix?

@satya164
Copy link
Member

satya164 commented Jan 31, 2017

Please check the doc I linked to which has exact instructions to run the app.

@thienanle
Copy link

I did follow that. Still getting the duplicate module errors.

@satya164
Copy link
Member

satya164 commented Jan 31, 2017

Run npm start, not react-native start, as written in the doc

@thienanle
Copy link

I get the same duplicate module error either way.

@satya164
Copy link
Member

Delete your node modules and try again, or just delete the node modules from the examples/NavigationPlayground

@dually8
Copy link

dually8 commented Jan 31, 2017

I'm getting similar errors and cannot run the examples.

~/D/r/e/NavigationPlayground $ > react-native start
Scanning 464 folders for symlinks in /Users/user/Downloads/react-navigation-master/examples/NavigationPlayground/node_modules (4ms)
 ┌────────────────────────────────────────────────────────────────────────────┐ 
 │  Running packager on port 8081.                                            │ 
 │                                                                            │ 
 │  Keep this packager running while developing on any JS projects. Feel      │ 
 │  free to close this tab and run your own packager instance if you          │ 
 │  prefer.                                                                   │ 
 │                                                                            │ 
 │  https://github.com/facebook/react-native                                  │ 
 │                                                                            │ 
 └────────────────────────────────────────────────────────────────────────────┘ 
Looking for JS files in
   /Users/user/Downloads/react-navigation-master/examples/NavigationPlayground 

[01/31/2017, 13:46:33] <START> Initializing Packager
[01/31/2017, 13:46:34]         HMR Server listening on /hot

React packager ready.

[01/31/2017, 13:46:37] <START> Building Haste Map
Failed to build DependencyGraph: @providesModule naming collision:
  Duplicate module name: NavigationPlayground
  Paths: /Users/user/Downloads/react-navigation-master/examples/NavigationPlayground/package.json collides with /Users/user/Downloads/react-navigation-master/examples/NavigationPlayground/__exponent/package.json

This error is caused by a @providesModule declaration with the same name across two different files.
Error: @providesModule naming collision:
  Duplicate module name: NavigationPlayground
  Paths: /Users/user/Downloads/react-navigation-master/examples/NavigationPlayground/package.json collides with /Users/user/Downloads/react-navigation-master/examples/NavigationPlayground/__exponent/package.json

This error is caused by a @providesModule declaration with the same name across two different files.
    at HasteMap._updateHasteMap (/Users/user/Downloads/react-navigation-master/examples/NavigationPlayground/node_modules/react-native/packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js:158:13)
    at p.getName.then.name (/Users/user/Downloads/react-navigation-master/examples/NavigationPlayground/node_modules/react-native/packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js:133:31)

EDIT: I followed the directions in that link, and I got different errors. See below.

~/D/react-navigation-master $ > npm start

> react-navigation@1.0.0-beta.1 start /Users/user/Downloads/react-navigation-master
> node ./node_modules/react-native/local-cli/cli.js start --config ./rn-cli.config.js

Scanning 688 folders for symlinks in /Users/user/Downloads/react-navigation-master/node_modules (4ms)
 ┌────────────────────────────────────────────────────────────────────────────┐ 
 │  Running packager on port 8081.                                            │ 
 │                                                                            │ 
 │  Keep this packager running while developing on any JS projects. Feel      │ 
 │  free to close this tab and run your own packager instance if you          │ 
 │  prefer.                                                                   │ 
 │                                                                            │ 
 │  https://github.com/facebook/react-native                                  │ 
 │                                                                            │ 
 └────────────────────────────────────────────────────────────────────────────┘ 
Looking for JS files in
   /Users/user/Downloads/react-navigation-master 

[01/31/2017, 14:45:49] <START> Initializing Packager
[01/31/2017, 14:45:49]         HMR Server listening on /hot

React packager ready.

2017-01-31 14:45 node[70834] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-01-31 14:45 node[70834] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-01-31 14:45 node[70834] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
 ERROR  Error watching file for changes: EMFILE
{"code":"EMFILE","errno":"EMFILE","syscall":"Error watching file for changes:","filename":null}
Error: Error watching file for changes: EMFILE
    at exports._errnoException (util.js:1022:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1283:11)

See http://facebook.github.io/react-native/docs/troubleshooting.html
for common problems and solutions.

npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/Cellar/node/7.4.0/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v7.4.0
npm ERR! npm  v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! react-navigation@1.0.0-beta.1 start: `node ./node_modules/react-native/local-cli/cli.js start --config ./rn-cli.config.js`
npm ERR! Exit status 11
npm ERR! 
npm ERR! Failed at the react-navigation@1.0.0-beta.1 start script 'node ./node_modules/react-native/local-cli/cli.js start --config ./rn-cli.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the react-navigation package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./node_modules/react-native/local-cli/cli.js start --config ./rn-cli.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs react-navigation
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls react-navigation
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/user/Downloads/react-navigation-master/npm-debug.log

@dually8
Copy link

dually8 commented Jan 31, 2017

Finally got it to work. Had to re-install watchman (brew install watchman) and give myself permissions for the ~/Library/LaunchAgents/ folder (sudo chown -R $(whoami) ~/Library/LaunchAgents/). Hope this helps anyone else having trouble.

@thienanle
Copy link

@satya164 looks like the instructions work for NavigationPlayground, but it doesn't work for ReduxExample. I tried with a clean clone of the repo.

@sibelius
Copy link

sibelius commented Feb 5, 2017

I have the saem error of duplicated module name

This error is caused by a @providesModule declaration with the same name across two different files.
Error: @providesModule naming collision:
  Duplicate module name: react-native-vector-icons
  Paths: /Users/sibelius/Dev/entria/react-navigation/node_modules/react-native/local-cli/core/__fixtures__/files/package.json collides with /Users/sibelius/Dev/entria/react-navigation/examples/ReduxExample/node_modules/react-native/local-cli/core/__fixtures__/files/package.json

This error is caused by a @providesModule declaration with the same name across two different files.
    at HasteMap._updateHasteMap (/Users/sibelius/Dev/entria/react-navigation/node_modules/react-native/packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js:158:13)
    at p.getName.then.name (/Users/sibelius/Dev/entria/react-navigation/node_modules/react-native/packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js:133:31)

@Steviey
Copy link
Author

Steviey commented Feb 5, 2017

Got it somehow working on Win.

https://steviey.github.io/win-react-navigation/

@AlanFoster
Copy link

There appears to be duplicated running steps both within https://github.com/react-community/react-navigation/blob/master/docs/guides/Contributors.md#1-run-the-native-playground and the readme.md of the native-playground folder.

However; I am getting the same @providesModule warning that others are running into:

This error is caused by a @providesModule declaration with the same name across two different files.
Error: @providesModule naming collision:
  Duplicate module name: react-native-vector-icons

@AlanFoster
Copy link

I was able to solve this issue by completely deleting my git clone of react-navigation, and following the steps within the contributors document

@efkan
Copy link

efkan commented May 29, 2017

Is there anyone to get run the examples on Linux.
I've applied the contributors document but I couldn't get run it.

I just changed "start": "npm run run-playground-ios" line as "start": "npm run run-playground-android" on package.json.

The outcome:

npm start

> react-navigation@1.0.0-beta.11 start /home/efkan/Projects/react-navigation
> npm run run-playground-android


> react-navigation@1.0.0-beta.11 run-playground-android /home/efkan/Projects/react-navigation
> cd examples/NavigationPlayground && npm run android


> NavigationPlayground@0.1.0 android /home/efkan/Projects/react-navigation/examples/NavigationPlayground
> react-native-scripts android

7:58:32 PM: Starting packager...
7:58:35 PM: Error starting packager: Error: Couldn't start project. Please fix the errors and restart the project.
    at /xdl/src/Project.js:1039:11
    at Generator.next (<anonymous>)
    at step (/home/efkan/Projects/react-navigation/node_modules/xdl/build/Project.js:1461:191)
    at /home/efkan/Projects/react-navigation/node_modules/xdl/build/Project.js:1461:361

@P-A-R-U-S
Copy link

I'm getting same error message
ARUS@ValentynPonomarenko:~/Desktop/Development/React/pluralsight1$ npm start

pluralsight1@0.1.0 start /Users/PARUS/Desktop/Development/React/pluralsight1
react-native-scripts start

12:28:40 PM: Starting packager...
12:28:42 PM: Error starting packager: Error: Couldn't start project. Please fix the errors and restart the project.
at /xdl/src/Project.js:1039:11
at next (native)
at step (/Users/PARUS/Desktop/Development/React/pluralsight1/node_modules/xdl/build/Project.js:1461:191)
at /Users/PARUS/Desktop/Development/React/pluralsight1/node_modules/xdl/build/Project.js:1461:361
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pluralsight1@0.1.0 start: react-native-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pluralsight1@0.1.0 start 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/PARUS/.npm/_logs/2017-06-02T17_28_42_743Z-debug.log

@cjoshmartin
Copy link

I am getting the same error as @P-A-R-U-S

@P-A-R-U-S
Copy link

@cjoshmartin npm update helped me.

satya164 pushed a commit that referenced this issue Feb 7, 2020
ShyJuno pushed a commit to ShyJuno/react-navigation that referenced this issue Apr 19, 2024
…navigation#75)

## Motivation

When pressing back in a StackNavigator nested inside the SwitchRouter, the screen would get popped, but the routeKeyHistory of the SwitchRouter gets popped even though the SwitchRouter doesn't handle the back action. This results in the next back action skipping the last opened tab.

## Fix

Before popping the `routeKeyHistory` stack, we check that the history actually changed. I also added a test for this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants