"Invariant violation: AwesomeProject application has not been registered" When creating an iOS device with static jsbundle

Firstly, I don’t know how to react, but I decided that deploying to an iOS device instead of a simulator would not be too difficult for working with documents. They were a little rare, but I got somewhere, and now I'm stuck. I created main.jsbundle and added it to the Xcode project and uncommented the line in AppDelegate.m.

When I deploy it, I get this error:

2015-03-26 16:13:08.538 AwesomeProject[4753:2477032] > RCTJSLog> "Running application "AwesomeProject" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF" 2015-03-26 16:13:08.547 AwesomeProject[4753:2477032] > RCTJSLog> "Error: stack: runApplication main.jsbundle:33769 jsCall main.jsbundle:7157 _callFunction main.jsbundle:7404 applyWithGuard main.jsbundle:877 guardReturn main.jsbundle:7206 callFunctionReturnFlushedQueue main.jsbundle:7413 URL: file:///private/var/mobile/Containers/Bundle/Application/DBC0DAF4-B568-4CF5-B156-9EFEE4E7FF4A/AwesomeProject.app/main.jsbundle line: 1536 message: Invariant Violation: Application AwesomeProject has not been registered." 2015-03-26 16:13:08.723 AwesomeProject[4753:2477032] > RCTJSLog> "#CLOWNTOWN (error while displaying error): Network request failed" 
+54
ios react-native
Mar 26
source share
11 answers

I am sure that the @krazyeom fix has nothing to do with this error. In my case, I fixed this by leaving the terminal that was running from the previous test application that I executed. It seems that the terminal was confused and was still connected to a process whose project was no longer loaded into Xcode. Try the following:

  • Close the terminal created by React Native.
  • Completely complete Xcode (may not be necessary).
  • Let's open everything and restart it.
+119
Mar 27 '15 at 16:35
source share

Your problem should not have anything to do with the console, if you correctly linked your javascript in the ios application, it will not try to talk to the dev server, it will just get javascript from the package.

From the error message, I would suggest that you might have renamed your main component. Make sure that 'AppName' you go to

AppRegistry.registerComponent('AppName' /* <- */, ... )

matches @"AppName" on your AppDelegate.m when called

 [[RCTRootView alloc] initWithBundleUrl:... moduleName:@"AppName" // <- launchOptions:... 
+48
Mar 27 '15 at 21:35
source share

This is because the server responsible for the response is still looking at the old one. First you need to close the server.

You can just kill the process.

In terminal

 ps aux | grep react 

Kill or execute the process and then

 npm start 
+26
Mar 28 '15 at 14:13
source share

AppRegistry defines the entry point to the application and provides the root component.

Your first parameter does not match the name of your project.

 AppRegistry.registerComponent('AwesomeProject', () => YourMainComponent); 

The first parameter of registerComponent should be your project name, the second parameter is an anonymous function that returns your root response component.

If the first parameter does not match the project name xcode, you will get this error so that your application is not registered.

If you don't have an AppRegistry application in the scope, you can call it that React.AppRegistry.registerComponent or you can assign it to AppRegistry var

 var { AppRegistry } = React; 
+17
May 24 '15 at 18:54
source share
 AppRegistry.registerComponent('abc',() => ***); 

'abc' should be the same as moduleName:@'abc' in the file name AppDelegate.m

+10
Jan 16 '16 at 16:17
source share

I had the same problem. I solved this by specifying the same name AppDelegate moduleName and AppRegistry.registerComponent

If you are using an application with $ react-native run-ios , you will need to rename the moduleName field to ./ios/[project name]/AppDelegate.m to match the new project name. Update your phone simulator and it should show a new code.

+8
Apr 15 '15 at 14:08
source share

Have you changed the name of the application you are registering? I started the application with the name "tricky" and then changed the name on this line:

 AppRegistry.registerComponent('MyNewApp', () => MyNewApp); 

and I started getting an invariant error.

+5
Mar 27 '15 at 20:15
source share

I'm not a fan of closing everything, so I dig further.

All I needed to do was my terminal window, I ran this command:

 ../lala/node_modules/react-native/packager/launchPackager.command ; exit; 

My project name was "lala", so find node_modules in your project.

replace lala with the name of your project, it should work.

If there is an error, says that the port is already in use:

  ERROR Packager can't listen on port 8081 

Then you have two options:

  • Kill an already running program.
  • Or change the port by going to: ../lala/node_modules/react-native/packager/packager.js , then find the port number, example 8081, and replace the port number that is not used.
  var options = parseCommandLine([{ command: 'port', default: 8082, }, { 

Save this file and run the above command again.

That way, I can run multiple reactions (ors).

+1
May 10 '15 at 9:52
source share

I got the same error, restarting everything, including xcode and terminal, worked for me.

+1
Jun 28 '15 at 19:06
source share

Link to an unnamed person.

he works for me.




I had almost the same problem that you had recently a few days ago. For me it was a real device.

Of all my research, the solution that worked for me is the following:

  • When you launch your application by typing "run-and-and-run run-android", an error appears.
  • So, get to your directory containing "adb.exe" (for me it was C:\Users\username\AppData\Local\Android\Sdk\platform-tools\ )
  • open a terminal. And enter adb reverse tcp: 8081 tcp: 8081
  • Then, restarting the application on the phone, it should work.
+1
May 28 '17 at 16:39
source share

I received a similar message in the console.

message: Invariant Violation: AwesomeProject is not registered.

I just added REACT_EDITOR=atom to the ~ / .bashrc file.

0
Mar 27 '15 at 2:58
source share



All Articles