Connecting to Localhost on Mac from Another Mac: Websocket Issues? - node.js

I have a node.js web app running on http://localhost:3000/ on my iMac. I am able to log on to that web app from Chrome on my MacBook using the Wi-Fi IP address of my iMac (found in System Preferences->Network) and the port my web app is running on:
http://10.0.0.37:3000
When using this technique, is there any reason why a websocket would fail in calling a service on a distant server?
Thanks in advance to any thoughts!

It turns out nothing was wrong with websockets. The camera on my MacBook was deactivated for some reason, and that was causing errors from the service I was accessing. I was able to reactivate the camera using instructions from this page:
Quit all apps that you are trying to use with the Camera > Open
Terminal (find in /Applications/Utilities) > copy and paste the
following command then hit the Enter key > Type administrator password
hit Enter.
sudo killall VDCAssistant
if still at the terminal, issue the following command:
sudo killall AppleCameraAssistant

Related

Remote debug node.js app, Chrome DevTools inspected device is missing

Steps to reproduce:
1. I running node.js (node#12.14.0) application on remote server (Ubuntu) with
> node --inspect app.js
Debugger listening on ws://127.0.0.1:9229/12345678-1234-1234-1234-123456789
2. On local (Windows 10) configured the SSH tunnel
On click "open" I see, where I input my password
Using username "user".
user#site.com's password:
_
3. Configured the Chrome (URI chrome://inspect/#devices) target discovery settings
4. Finally I see no devices on Remote Target
But expecting something like this
5. netstat -a -n | grep 9221 on the server returns
What I doing wrong? How do I get the target?
Similar topics:
1. How to debug remote node.js app using chrome devtools
2.
The following worked for me
P.1 Run node.js app with root user
> node --inspect-brk app.js
P.2 For tunneling used Windows PowerShell with following line
ssh -N -L 9221:localhost:9229 root#site.com
In Discover network target add 127.0.0.1:9229 instead of the localhost:9229

Grails run-app fails on VM VirtualBox: hangs on build, can't access server

I'm new to Grails and attempting to implement the Hello World app described at grails.org's Getting Started guide.
I have installed Grails using SDKman on an Ubuntu Server 16.04 VM (VirtualBox, running as a service). My host machine is Windows 10.
I configured two network adapters in VirtualBox: the first a NAT with port forwarding (3022 host -> 22 guest, 8080 host -> 8080 guest), the second a Host-Only adapter.
I can SSH into my VM just fine from my Windows host (using Bash): ssh -p 3022 user#localhost
When I run python3 -m http.server 8080 from that SSH session, it successfully listens on both localhost:8080 and :8080. I can access both URLs from a browser on my host machine.
When I run grails run-app it hangs forever, and none of the above endpoints work from my host.
When I run grails run-app --verbose I see it compile without complaint through "Building 85% > :bootRun". I understand that this is expected behavior, but I never see "Application started" or any similar message. It never starts.
ONE TIME the following command succeeded in building and running the app, creating exactly the result I needed:
grails -Dserver.port=8080 -Dserver.host=0.0.0.0 run-app --verbose --stacktrace
However when I stopped the app and tried again, it failed as before.
I notice that VirtualBox > Settings > Network > Adapter #2 which I had set as "Host-Only Network" has multiple times reset itself to Bridged. I suspect that this reset may have caused my problem. But I don't know how to prevent the reset, or to restore that functionality I so briefly had.
Thanks, anyone who can help!
Resolved! Turns out run-app just takes a LONG time to finish compiling and building, upwards of 10 minutes. So I just needed to wait ~5+ minutes with no visual sign of action before the completion message would show and I could access my site. :)

Ubuntu : Turn on and login into a remote computer

I want to run some application on a remote computer. I am able to turn it on using wakeonlan but how can I log into it and start the application using terminal?
ssh yourusername#computernameorip
ProgramNameToExecute

ReferenceError: Can't find variable: __fbBatchedBridge

Using just the default code from react-native init AwesomeProject, when I run the app I get the 'ReferenceError: Can't find variable: __fbBatchedBridge (line 1 in the generated bundle)'.
And, when I 'Reload JS', the app just has the white background rather than any 'hello world' views. I haven't touched any of the code from the init.
Any ideas how to resolve the error?
Screenshot (click to view full size):
Using:
Ubuntu 15.10, 64-bit
Node.js v5.3.0
reactive-native v0.1.7
Nexus 5X, API 6.0.1
I generally see this when the packager hasn't started. Ensure that is running by running react-native start
I had the same issue while using Visual Studio Android Emulator. When the red screen shows up type in the command line
adb shell input keyevent 82
This will trigger the shake event and launch the dev menu
Then hit Dev Settings > Debug server host & port for device and enter <your ip adress>:8081. If for some reason you cannot type in the field you can trigger the text action in the command line by using
adb shell input text <your ip adress>:8081
i solved it using this command
adb reverse tcp:8081 tcp:8081
Thank you rmevans9 and Anonsage for your answers!
I am using HTC One on Ubuntu and there is no menu option, anyway this is the summary of the answers that worked for me:
Create the project
$ react-native init MyProject
$ cd MyProject/
In first console tab run and leave it running as you develop (react-native start alternative):
$ npm start
In second console tab compile and install the project (connect the device to the USB if you want):
$ react-native run-android
Fix ReferenceError: Can't find variable: __fbBatchedBridge:
Find you local ip address by executing ifconfig on Linux/Mac, for example:
inet addr:192.168.0.3
Shake the device to see menu options while app is running (if you don't have "Menu" button)
Go to Dev Settings -> Debug server host & port for device in Debugging section and copy your local ip address with the specific port:
192.168.0.3:8081 (the port can be viewed when running npm start from the first tab)
then go/press Back
Shake the device to see menu options again and press Enable Live Reload (to see changes live when editing)
Shake the device to see menu options again and press Reload JS
This worked for me according to documentation
http://facebook.github.io/react-native/docs/running-on-device-android.html#content
Using adb reverse
Note that this option is available on devices running android 5.0+ (API 21).
Have your device connected via USB with debugging enabled (see paragraph above on how to enable USB debugging on your device).
Run adb reverse tcp:8081 tcp:8081
You can use Reload JS and other development options with no extra configuration
Then Run react-native run-android which will automatically start dev server on 8081 port on your dev machine if not already running.
I encountered this when I had specified different react native versions in my packages.json and my build.gradle file. Making sure they matched, running npm update, and rebuilding from android studio fixed the issue for me.
I had the same problem.
As I followed all the steps mentioned in other answers, I could not resolve the issue.
In my case the firewall was blocking the packets coming from android.
Also If you have submitted your app for the iTunes store, also make sure that your jsCodeLocation is back to the localhost, as shown bellow:
jsCodeLocation = [NSURL URLWithString:#"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
/**
* OPTION 2
* Load from pre-bundled file on disk. The static bundle is automatically
* generated by "Bundle React Native code and images" build step.
*/
//jsCodeLocation = [[NSBundle mainBundle] URLForResource:#"main" withExtension:#"jsbundle"];

Apache stopped working after executing the command "node server"

I use PuTTY to execute SSH commands. I entered this command node server and pressed enter. After that, access to cPanel and WHM have failed. All my sites are down now. Only Power Panel is working. Could you guys suggest what should be done?
Thanks!
Sorry to answer my own question, it is now resolved. I used SurfEasy VPN in order to access PuTTY via a proxy. I was able to send the command pkill node and my sites are now running again.

Resources