React cannot find entry file in any of the roots - ios

I am using React Native as a Pod in my iOS project.
When I try to load a view that I created with React Native I get the Error screen referring me to the Terminal window where npm is running.
In the Terminal the error I am seeing is:
Error: Cannot find entry file in any of the roots:
I tried a few things, moving the file to a different location, but no luck.
I did run "npm start" and I am looking for the file in "http://localhost:8081/".
The current location of the file is in the same location as where I ran "npm start" from.
I am completely stuck here.
Did I configure something wrong. How can I troubleshoot from here?

Check for the node server running in one of the bash terminal, this was probably kicked by previous ReactNative XCode project you launched earlier. Stop that process and run XCode project again, this should fix the problem.

Sorry for answering my own question (a bit lame), but I hope it helps somebody else.
Apperantly we need run the npm command by giving an alternative path.
npm run start -- --root <directory_with_your_react_component_js_sources>
On http://facebook.github.io/react-native/docs/embedded-app.html#content is a guide on how to integrate React Native in an existing app.

That happens when React wants to use a port that is already being used by other application. Since React listens to port 8081, you can get the process running at that port typing the following in Shell:
lsof -n -i4TCP:8081
You'll get an answer like this:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 28571 username 32u IPv6 0x742e2ab233abdb9f 0t0 TCP *:sunproxyadmin (LISTEN)
Just killed that by typing in shell
kill -9 <PID>. Use the same PID that has been provided in the last answer.
Then run npm start.

There's this issue:
https://github.com/facebook/react-native/issues/541
Which seems the same thing. The user there seemed to indicate that they had run the project from that directory before, which leads me to wonder if this is due to a hanging or left-over packager from a previous run? Try closing the terminal window and re-running the Xcode project.
In general this sounds like an issue with the packager not generating the files as expected. Are there any other messages in the terminal window?

I wanted to update this after getting a bit frustrated my setup still wasn't working after killing all node processes and running the command above.
There seems to be a ReactNative open issue at present: https://github.com/facebook/react-native/issues/14246
The solution for this is to kill the externally launched package manager and just run "npm start" in the project folder.

Check if you have index.ios or index in your AppDelegate.m:
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index.ios" fallbackResource:nil];
I had index and I was previously using index.ios and index.android so that's why it was failing.

In my experience, it is because of Watchman and Jest.
The solution I've found is
add
name = name.replace('/', '\\');
to 'node_modules\jest-haste-map\build\crawlers\watchman.js'
You can check further info here
Watchman not working with React Native

Related

How do I resolve this OSError: [Erno 48] Address already in use error while working with the byob botnet on GitHub?

(I have seen other solutions to "Errno 48" issues on StackOverflow, but none have been successful yet.)
I am trying to develop a botnet using byob on github here: https://github.com/malwaredllc/byob
I am encountering a address in use error every time I run the command sudo ./startup.sh. It returns OSError: [Errno 48] Address already in use.
However when I attempt to use the ps -fA | grep python and kill the associated 502 18126 16973 0 9:16PM ttys000 0:00.00 grep python by using kill -9 181216, I get this error: kill: kill 18126 failed: no such process.
Does anyone have any idea what to do?
I am using a "MacOS M1Pro Chip OS V12.0.1 Monterey". Also the program byob is trying to run on port 5000 of IPv4 127.0.0.1 (this is a generic IP not specifically mine). http://127.0.0.1/5000.
In case you try to duplicate the problem you need to install docker.io or the docker desktop app depending on os then navigate to cd <outer-dir>/byob-master/web-gui then execute sudo ./startup.sh. The code will not work without access to docker, and the program needs to be ran with admin perms using the prefix sudo. The actual downloads take a while and it will prompt you to restart once. Then when you run it again, I encounter this problem...
Please let me know if someone was able to fix this. Thanks!

Docker Failed to Initialize on Windows

Here, I have problem regarding pulling docker-dev in docker image for making my development environment but when I tried to pull docker-dev. I got the error like docker manifest not found.
Can anyone help me out with this error...plz
before this
I want to know about the docker failed to initialize error which i'm having right now...
the error is like,
I tried so many things like re-install the docker desktop or WSL updates, but didn't worked.
And error in the command be like...
So if someone can help me out with this....plz help me out
Got the same issue and fixed it by deleting %appdata%\Docker as mentioned by Github User "tocklime"
(Original Source : https://github.com/docker/for-win/issues/3088)
Short solution: delete %appdata%\Docker\settings.json and let Docker to create a new one.
Take a backup of the file for the next time it gets broken.
<tl;dr>
I face this issue almost every month and I hope this will get fixed definitely.
Following tmBlackCape answer, I checked the %appdata%\Docker directory and found settings.json damaged (editor tells it's a binary file and of course it shouldn't).
I deleted the file and Docker Service (still running) created a new one with default values. If the service isn't running, just launch it again.
You could need to change settings (via GUI, as recommended) to catch your needs.
I made a backup copy of my custom settings.json so next time I can replace the broken one without losing custom configuration.
Go to the directory C:\Users-------\AppData\Roaming\Docker and delete the file settings.json . Docker takes care of rewriting it at startup.
This manipulation solved the problem for me !
Docker failed to initialize
C:\Users[USER]\AppData\Local\Docker
C:\Users[USER]\AppData\Roaming\Docker
C:\Users[USER]\AppData\Roaming\Docker Desktop
Once deleted above directory, I didn’t have to do anything else, Docker Desktop started booting up as normal.
The error message I got was not exactly the same the OP got. For me, it said Docker failed to initialize. Docker Desktop is shutting down.
TL;DR
The powershell executable was missing from my local machies PATH. I had to add C:\Windows\System32\WindowsPowerShell\v1.0 and docker started again.
The longer story
I tried everything that was mentined in this thread and nothing worked for me. When I looked at the task manager of my local machine to see if any docker-related process was started, I noticed that Docker Desktop.exe itself was started. However, the com.docker.backend.exe not. Docker tries to start that exe in an infinite loop, but as soon as it started it crashed again after half a second.
I then took a look into com.docker.backend.exe.log, which is located in %localappdata%\Docker\log\host and noticed the following line:
[2022-07-07T10:46:57.936079700Z][com.docker.backend.exe][F] exec: "powershell": executable file not found in %PATH%
I then went ahead and just added the path to powershell to PATH (which is C:\Windows\System32\WindowsPowerShell\v1.0)`. As soon as I added that, everything started working again.
I have no idea how the path to the powershell executable got removed from PATH. I certainly did not do that myself.
This happened to me after Docker Desktop upgrade to version 3.6.0 (67351), too. (Which was surprising, because it worked before the upgrade.)
Due to the help in the top answer right now, I went to the above settings directory: %appdata%\Docker, looked at the logs and deleted/renamed the file settings.json -> Docker Desktop started immediatelly ; there had been a process retrying in the background.
In the time before that, the backend.exe.log had been all "unmarshal" something something:
settings.json: json: cannot unmarshal bool into Go struct field Content.proxyHttpMode of type string"
common/cmd/com.docker.backend/internal/settingsloader.GetSettings(0x0, 0x0, 0x0)
So, the above message 'tipped me off' as to where the actual error on start may be. Hmm...
For me the solutions here didn't help, but here's what helped.
Make sure the folder .docker/ in your home directory isn't marked as hidden in Windows. If it's hidden, Docker won't see it.
Make sure docker has Active Directory to .docker folder. For example, if the owner of .docker/ is SYSTEM and not your user, Docker won't be able to read it and crash.
For me deleting the folder %appdata%\Docker did not work.
Instead I had to run the following power shell command as admin.
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
References.
https://stackoverflow.com/a/63845592/1977871
https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v#enable-hyper-v-using-powershell
My windows features with running docker desktop are as follows.
It resolved me by deleting the file
C:\Users{username}\AppData\Roaming\Docker\settings.json
I had the same issue. I'm on Docker Desktop 4.8.0. The following solution worked for me:
Uninstall Docker Desktop
Delete .docker folder from C:\Users\{Username}
Delete Docker folder from C:\Users\{Username}\AppData\Local
Delete Docker folder from C:\Users\{Username}\AppData\Roaming
Delete Docker folder from C:\Program Files
Run CCleaner on Registry and Custom Clean
Restart Computer
Install Docker
Restart Computer
Start Docker
That's all.
Go to C:\Users\asd\AppData\Local and delete Downloaded Installation directory.
C:\Users\asd\AppData\Roaming and delete Docker and Docker Desktop directory.
Then start docker.
Didn't found the AppData folder in users[myUser] or anywhere. re-install solve it for me
latest update 4.10.1 has issues, i downgraded to 4.6.1 and it worked however i think powershell is closely linked to this issue
It happened due to local data corruption. You can check in VM log inside %appdata%\Docker.
I was able to reset and restart by renaming setting.json and then restart the Docker desktop by deleting all the previous log folder and temp folder clean. If this does not help.
Try to kill all the processes running in through the task manager
and then run Power shell in administrator mode and then shoot the command if you are using an older version of Lsmanager Restart-Service LxssManager.
On my side, uninstalling HyperV did the trick :
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor
I also (as suggested in the voted answer):
Uninstalled docker desktop,
Deleted any docker related content in %APPDATA% as suggested
Delete any docker related keyys in registry (may be not necessary)
Then reinstalled it
And it solved the problem (but without hyperV removal it didn't work).
There are a few great solutions; however, it didn't work for me. Most of the "fixes" suggested here are already implemented and it just didn't work. I chose a different approach.
I looked at the docker releases and saw what was actually affected by their latest version not working (4.10). These things are normal, especially if the software engine has been updated.
Going through Docker releases, the latest release that didn't touch the Docker engine is 4.8.0. I downloaded and works great.
Removing settings.json file or %AppData%\Docker folder did not work for me. After uninstalling/installing the docker, the issue was solved. (Note: I couldn't try other possible solutions that are required the admin privilege)
The below Steps worked for me,
Step 01:
Navigate to the below-mentioned paths and delete the below-mentioned directories,
C:\Users[USERNAME]\AppData\Local\Docker directory
C:\Users[USERNAME]\AppData\Roaming\Docker directory
C:\Users[USERNAME]\AppData\Roaming\Docker Desktop directory
Then restart the docker again
If you didn't find the AppData folder in users[USERNAME] or anywhere
Step 02: Type the below path in the "Run" to directly open the app data location for you
%appdata%\Docker
Then Delete the below-mentioned directories,
C:\Users[USERNAME]\AppData\Local\Docker directory
C:\Users[USERNAME]\AppData\Roaming\Docker directory
C:\Users[USERNAME]\AppData\Roaming\Docker Desktop directory
Then restart the docker again
Note: If these steps do not help you. Try to kill all the processes running in through the task manager. And again delete the directories and start the docker
if you still can't find the issue you may use this trick and i'm 100% sure this will work
first check your operating system is up to date means no remaining updates if you pass this step then come to 2 step open window command prompt in run as administrator
then type wsl --install then type wsl --list --online then wsl --install -d Debian
then open docker if error come
then install wsl 2 linux https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package
then restart docker or your machine and then if error also occur then type then wsl --update i hope this will work Regard : Hammad Khadim

How to stop and run Vapor again in Xcode?

I've followed the Vapor tutorial to create a hello app. In Xcode, when I run the Run scheme on my Mac, the app starts and runs as I can see by opening http://localhost:8080/. After making some changes in the code, I stop the Run scheme and I expect the Vapor server to shutdown. However, it continues to serve requests.
Message from debugger: The LLDB RPC server has exited unexpectedly. Please file a bug if you have reproducible steps.
Program ended with exit code: -1
Obviously when I make some changes and run the Run scheme again, I get the following runtime error:
Swift/ErrorType.swift:200: Fatal error: Error raised at top level: bind(descriptor:ptr:bytes:) failed: Address already in use (errno: 48)
Program ended with exit code: 9
How do I stop or restart the server?
This is a long standing issue with Xcode/LLDB. You have a few options:
attach to the process and stop it via Xcode
run killall Run
run lsof -i :8080 to find the process connected to port 8080 and then kill <process_id> (this is useful if you're running multiple apps side by side and only want to terminate the orphaned one)
This is quite frustrating and to be honest I dont know why this happens, but I do the following to terminate the process:
In Xcode,
Go to Debug -> Attach to Process
At the very top of the sub-menu is: Likley targets section with an entry Run (nnnn). It will have an icon of the Terminal application
Click to attach
Then stop the Xcode Run in the usual way.
Out of interest, the next time you run your vapor app, if you open the Debug Navigator, at the top you will see the Terminal icon with Run PID nnnn. Where nnnn is the PID. If you go to Debug -> Attach to Process again, you can see this at the top of the sub-menu as before. But you wont be able to attach to it because it is already being debugged.
Hope this helps you or someone in the future.

how to kill uWSGI process

So I have finally gotten nginx + uWSGI running successfully for my Django install
however the problem I am having now is when I make changes to the code I need to restart the uWSGI process to view my changes
I feel like I am running the correct command here (i am very new to linux as well btw):
uwsgi --stop /var/run/uwsgi.pid
uwsgi --reload /var/run/uwsgi.pid
I get no error when I run these commands however my old code is still what loads
I also know its not a coding issue because I ran my django app in its development server and everything ran fine
The recommended way to signal reloading of application data is to use the --touch-reload option. Sample syntax on a .ini fine is:
touch-reload /var/run/uwsgi/app/myapp/reload
Where myappis your application name. /var/run/uwsgi/app is the recommended place for such files (could be anywhere). The reload file is an empty file whose timestamp is watched by uwsgi, whenever it changes (by, for example, using touch) uWSGI detects that change and restarts the corresponding uWSGI application instance.
So, whenever you update your code you should touch the file in order to update the in-memory version of the application. For example, on bash:
sudo touch /var/run/uwsgi/app/myapp/reload
Note --reload is an undocumented option on current uWSGI version.

iphone reboot programmatically

I have code
system("reboot")
The reboot command works in the terminal, but even if I run the app as root, the operation is still denied. Has anyone found any way that works, or can explain a bit about SBSetting's reboot, which makes me curious?
I have finally found a way to programmatically restart an iOS device without rooting a device!!!!
The command line tool to restart an iOS device is called libimobiledevice:
http://krypted.com/mac-os-x/use-libimobiledevice-to-view-ios-logs/
It is truly amazing. One snag I ran into while installing was trying to install this line:
brew install -v --devel --fresh automake autoconf libtool wget libimobiledevice
However I got around the install problem by running this line:
brew install -v --fresh automake autoconf libtool wget libimobiledevice
After that problem, I followed the rest of the instructions and voila!
Most of the commands can be found on this page:
http://krypted.com/uncategorized/command-line-ios-device-management/
The magic command that restarts the iOS device is:
idevicediagnostics restart
What is truly amazing about this tool is not only restarting an iOS device but also outputting iOS device logs to mac's terminal app using the following command:
idevicesyslog
I figured out a way to do it, although it's a bit convoluted. The problem is that even if you setup your app to run as root, when you make system() calls, you're apparently still limited to user mobile privileges. Since mobile cannot call reboot (successfully), this doesn't work.
The way I got around this problem is to take advantage of a new feature that SBSettings supports. SBSettings has a privileged daemon process that runs. It allows you to plug in your own commands, by simply writing a script (or other executable) and dumping it in the appropriate directory (/var/mobile/Library/SBSettings/Commands). Once you then restart the sbsettingsd process, you can get it to run your script by posting a notification. If you name your script
com.mycompany.reboot
then from within your app, you can execute this code:
#import <notify.h>
notify_post("com.mycompany.reboot");
Then, you make com.mycompany.reboot a simple shell script like this:
#!/bin/sh
reboot
And make sure to chmod 755 on your com.mycompany.reboot script. The full details of this SBSettings command feature can be found here:
http://thebigboss.org/guides/sbsettings-toggle-spec (see Calling External Functions and Scripts ...)
Anyway, it does require your app to depend on SBSettings, but it's a free app, and most users would probably want to have it anyway. For now, it accomplishes the goal of rebooting (or anything else that requires root access) programmatically, via notify_post().
This answer might feel hacky to some but I have not found a better solution on how to restart an iOS device that has not been jailbroken so here goes my answer:
In order to restart a device from the command line I do some prep work:
Connect device to computer
Add iTunes shortcut to your dock
Select spotlight and search for an application called Automator [must have Xcode installed in order to launch Automator!]
When Automator launches, select the Application option
Select the record button to start recording following actions
Select the iTunes shortcut
Select your device from the Device options
Select the Restore Backup... button
Select the Restore button
Select the stop button on the Automator app to stop recording.
From the Automator application, select File from the top bar and Save your newly recorded app to a location of your choosing
At this point you have an app file that will execute the steps mentioned above. I tend to leave iTunes open as it will always have the iOS device hooked up and ready to be accessed. When iTunes is closed and relaunched, the device takes time to fully connect with iTunes and this tends to break the flow of the Automator app.
At this point I can go into a terminal, go to the location of the app file and run the following command [EXAMPLE]:
open automator.app
(replace 'automator.app' with the name of your file)
If you are like me and your are running this command in jenkins, you will need to run the following commands:
open [location]/[your_app_name.app]
sleep 30
For some reason, the automator app needs the sleep time to complete all the recorded actions.
Also, I am sure you can also write an applescript to do all of this but I hate applescript and took the easy way out!
did you try NSTask: Execute a terminal command from a Cocoa app
This is not possible if the app is running in its sandbox. on a jailbroken phone you might be able to execute the reboot shell command.

Resources