Can't connect to local Node App - javascript

I just started with a little bit MEAN-Magic by following along this tutorial. It was working pretty good (installation and so on). Now I'm stuck at:
STEP 4: Creating an ExpressJS application
I executed express mytestapp, cd mytestapp, npm installand node app.jsand am able to see the folder structure in the Terminal, but if I open Safari with "http://localhost:3000" I get the message
Safari can't Connect To Server... Safari can't open the page "localhost:3000" because Safari can't connect to the server "localhost"
How can I troubleshoot this? I'm totally new to this. (Not sure if this matters, but I'm working from a mac at the moment).

Related

React app server not running on 127.0.0.1

I've recently built a project using create-react-app. Everything is fine until today.
I run npm start as usual and try to visit http://localhost:3000. But I got LOCALHOST REFUSED CONNECTION error. And I got this on terminal's output in vscode.
Local: http://localhost:3000
On Your Network: http://172.24.194.157:3000
I made a small test: using vite to create a react app and npm run dev. And it's just fine to visit http://localhost:5173.
At first I thought it might be a problem with port. But turns out not. Because http://172.24.194.157:3000 is ok to develop my react-app.
So I guess, my browser resolute localhost to 127.0.0.1, but 127.0.0.1:3000 is not available due to react-scripts start serve the app on 172.24.194.157:3000.
But WHY is that happen? I made no changes to any config.(though I didn't open this project for about 2 weeks). It would be a great help if anyone can answer this. Thanks!
ENV INFO:
wsl1 in windows 11 (Ubuntu 20.04)
node: v16.9.0
npm: 8.19.3

Error when migrating to macOS: TypeError: Cannot read property 'apply' of undefined

I am building a web app using React and Redux on the front end and Node on the back end with Express and MongoDB.
My app runs fine on my Windows machine. Today, I cloned the repository onto my macOS device and ran npm install inside the client and the root directory and then I tried running the application to find this error message pop up:
I'm not sure what this error message means and stack trace displays that the error originates from Redux inside the node_modules folder, which is code I did not write or touch. Here is the repo: https://github.com/furtivepygmy/devconnector
I'm new here, so please go easy on me. I always face issues when moving my workspace between macOS and Windows, however I can't seem to fix this one. Is there something I need to do when migrating between operating systems?

Meteor server crashes very frequently without any error

I am working with the Meteor application and I deployed the same over EC2 instance. It was working fine till a few days back.
But now the server process kill automatically without any error log or
console
I tried to get the error but unfortunately, as there are not any logs I am unable to find out why the server is crashing again and again.
I have a medium EC2 machine on which the application is running.
I am using nohup for running the application in the background.
Below is the command I used to start the server:-
nohup meteor --settings SETTINGS-PRODUCTION.JSON &
I am wondering to know about server crashes due to nohup or some other reason is there.
Please let me know how we can console uncaught exception in the meteor-like we do in express.
What should I use to auto restart the server if the process is killed
by any error or exception?
Any help would be much appreciated!
Thanks
Using nohup is quite a low-tech solution. Things like Phusion Passenger, PM2, or forever do a better job.
Also your docker container can be configured to automatically restart the process.
Even better is a tool called Meteor Up, which makes it really simple to deploy Meteor apps to EC2.
EASILY DEPLOY YOUR APP Meteor Up is a production quality Meteor app
deployment tool.
Install with one command:
$ npm install --global mup
http://meteor-up.com/

electron + simplewebrtc workable?

Does anyone use electron + simplewebrtc successfully?
I used simplewebrtc to build a web app. It works fine in browsers.
When I migrated it into electron, something weird happened.
At first I used two copies of my electron app to make them connect each other, but failed.
Then, I made a web browser version and a electron version connect each other.
First, only when the electron version joined the room first, and then made the web version join the room, they can connect each other. otherwise, if the order changes, they cannot get the event peer.pc.iceConnectionState to "connected".
Second, even if them are connected, data channel only works on one way. Only web version can send message to electron version. If I try to let electron version send a message to web version, nothing happened.
During the whole time, no any error was thrown.
Thank you in advance.
simplewebrtc 2.2.3 - 3.0.1
Electron: 1.7.6
Web browsers: Chrome 62, Opera 49, Chromium 58

Running Meteor mobile app on physical Android device

I'm having an hard time trying to run my Meteor app on my Android device (LG G2).
I googled for answer and didn't find anything like what I encounter. I followed the instuction and everything went fine, added the Android platform to my project and ran it with meteor run android-device. The device LG G2 is plugged with a USB cable to the machine I'm building and running the app with, and the device has USB debugging enabled. Everything seem to be fine, my terminal indicates:
Started proxy.
Started app on Android Device.
I20150530-16:38:11.280(3)? - waiting for device -
Started MongoDB.
Started your app.
App running at: http://localhost:3000/
No error indication, nothing suspicous, but the app doesn't come up on the device. Nothing happens. Anyone has a clue? I tried to give my own IP and port to the command without a change.
You need to set the USB connexion on your android device as "camera". Whith my s4 mini I had the same symptoms and that was the solution.
I'll list what I've done to solve it, because it's a mix of all the solutions I got here.
I'm using Ubuntu, and LG G2 as device.
I created the /etc/udev/rules.d/51-android.rules. file with
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="1004", GROUP="plugdev" inside. (Detailed instructions here on step 3: http://developer.android.com/tools/device.html#setting-up, thank you #ChristianFritz). Pay attention that "1004" is the vendor
ID of LG.
I realised that for some reason I didn't have the ADB on my machine so I couldn't use adb devices and connect with my device. I followed this guide:
http://lifehacker.com/the-easiest-way-to-install-androids-adb-and-fastboot-to-1586992378 to install the missing ADB (linux section).
I got an error: adb server is out of date. killing... which terminated connection between the device to the machine, but after following #yoh advice, I changed my USB connection from MTP to PTP and tried again. This time worked.
Managed to run my app successfully on physical LG G2 after those steps using Ubuntu.

Categories