Permalink
Browse files

Add a hint to a very common AppRegistry error

Summary:
**Motivation (why should we merge this?)**

I see the following error very often when working on multiple apps and switching between them. In fact, switching between apps is the only reason why I ever saw the error. However, the error message is very unhelpful:

![screenshot 2017-02-22 16 15 29](https://cloud.githubusercontent.com/assets/346214/23221214/5f6bc7ba-f91c-11e6-9482-9183c27c5e9d.png)

**Test plan (required)**

![screenshot 2017-02-22 19 44 54](https://cloud.githubusercontent.com/assets/346214/23229247/830f7142-f937-11e6-9657-bad83563f3b0.png)
Closes #12517

Differential Revision: D4600082

Pulled By: mkonicek

fbshipit-source-id: 011c71dbac9e294348fd06c8e6d651228fac3288
  • Loading branch information...
mkonicek authored and facebook-github-bot committed Feb 22, 2017
1 parent e774d99 commit a6adc501e8902ce87b31917ea1d5299058c9aa7e
Showing with 10 additions and 3 deletions.
  1. +10 −3 Libraries/ReactNative/AppRegistry.js
@@ -149,9 +149,16 @@ const AppRegistry = {
BugReporting.addSource('AppRegistry.runApplication' + runCount++, () => msg);
invariant(
runnables[appKey] && runnables[appKey].run,
'Application ' + appKey + ' has not been registered. This ' +
'is either due to a require() error during initialization ' +
'or failure to call AppRegistry.registerComponent.'
'Application ' + appKey + ' has not been registered.\n\n' +
'Hint: This error often happens when you\'re running the packager ' +
'(local dev server) from a wrong folder. For example you have ' +
'multiple apps and the packager is still running for the app you ' +
'were working on before.\nIf this is the case, simply kill the old ' +
'packager instance (e.g. close the packager terminal window) ' +
'and start the packager in the correct app folder (e.g. cd into app ' +
'folder and run \'npm start\').\n\n' +
'This error can also happen due to a require() error during ' +
'initialization or failure to call AppRegistry.registerComponent.\n\n'
);
runnables[appKey].run(appParameters);
},

0 comments on commit a6adc50

Please sign in to comment.