phonegap changing from port 3000 - node.js

On the c9 IDE(c9.io) i installed node and phonegap globally, and started to build an app.
I can run the app on port 3000 by usign the command: phonegap serve
but i would like to run in a diferent port, using:
.listen(process.env.PORT, process.env.IP);
that is the way to run node app on c9.io:
https://docs.c9.io/docs/writing-a-nodejs-app
I am having trouble to find the file to edit and change the port.
Thanks

phonegap serve -b $IP -p $PORT
thant is the command to run on c9

Related

All ports not available with React npm run start

So up until yesterday I was able to do npm start no issues.
The versions of things I'm running
OSX Mojave...
npm: '8.19.3',
node: '19.2.0',
Now it is saying that port 3000 is in use. I've done all the tricks to see if 3000 is in use is isn't
changed the port to 3001 3005 4444 and various other and it doesn't work.
Still the same message.
serve -s build works great and runs the app on 3000. no idea what is going on..
error message
✔ Something is already running on port 4001.
Would you like to run the app on another port instead? … no
I've tried
user#computer >> npx kill-port 4001
Could not kill process on port 4001. No process running on port.
user#computer >> mtbcrm_react % lsof -i tcp:4001

Is it possible to run nodejs server and react server on single port? [duplicate]

This question already has answers here:
Can two applications listen to the same port?
(17 answers)
Closed 3 months ago.
I want to run both react and node on single server because i don't want to start it together.
like when i run npm start both will be run because i want to run project using electronjs.
I tried to run command npm start client.js server.js but it didn't work
you can't run 2 servers in the same port and the same IP you should run each one on a different port, react has a default port(3000) to run on you should set your nodejs server to another one like 8000.
You cannot do that you'll need two different port numbers 3000 for server 3001 client...
otherwise, you can use Docker to run on the same port and map to your host on different ports with docker commands:
docker run CLIENT_IMAGE -p 3000:3000
docker run SERVER_IMAGE -p 3001:3000

Starting a simple HTTP-server using "npm" without installing npm

Which command do I need to use to start a simple HTTP server using "npm", the specified port to be used is port 8080. Also, I don't have to download the npm package. The only hint I got is that I can download the basic web server packet, also from there I can specify the port 8080?
Once the http server has been configured with the x-server name at port xxxx, you can start it with the command:
x-server -p xxxx
for example if my server's name is simple-http-server at port 8080:
simple-http-server -p 8080
would start it.
for the next exercice:
php -S 127.0.0.1:8080
I am also getting started on HTB.
contact me (in the next 23 hours) at this account or leave a correspondance as comment if you want to work with me to break through on HTB.
Once npm is installed, the command is simply: http-server -p 8080 (without writing 'npm' at the beginning of the line).

Node web server not visible externally, but Python is (MacOS)

I'm just starting to build an Ionic 2 app, but I can't get it working on my mobile device.
Python (works)
To demonstrate that the phone can see the host, I tried a Python server:
$ python -m SimpleHTTPServer 8000
Serving HTTP on 0.0.0.0 port 8000 ...
If I go to http://192.168.8.101:8000 on my phone, it connects fine and displays the directory listing.
Node (fails)
However, when I start Ionic:
$ ionic serve -p 8000
[...]
[INFO] Development server running
Local: http://localhost:8000
External: http://192.168.8.101:8000
I can load it in my host's web browser, but I can't see it from my phone nor another computer (it times out). I also tried a basic node server:
$ npm install http-server -g
$ http-server -p 8000
Starting up http-server, serving ./
Available on:
http://127.0.0.1:8000
http://192.168.8.101:8000
With the same result as Ionic: accessible from the host, but not from the phone.
Is there something blocking the request? Or is there some Node configuration I'm missing? I'm new to both Mac OS and Node, so I don't know where to look.
Embarrasingly, this turned out to be a firewall issue. In System Preferences > Security & Privacy > Firewall > Firewall Options, Node was explicitly set to deny incoming connections:
Changing it to Allow has fixed it. Phew!
Just execute ionic address and you'll get an IP address in your command line. Try with that ipaddress:port number from your mobile which will enable you to access your site from your phone.
Just incase if the ionic address command doesn't return anything, you need to execute the below command to point it to your ip,
ionic serve --address YOUR_IP_ADDRESS
Hope this helps!

How can I serve Ionic app on a different port?

I'm trying to run the ionic project on browser but the default port 8000 is already in use.
I need to change the port
I'm using this command:
ionic run browser --port 8002
but its not working.
The documentation says the port options are --port|-p
Thanks
Try ionic platform add browser before,
or
ionic serve -p 8002 --dev-logger-port 8103
instead...
When running 2 ionic apps at the same time, it's not enough to specify a new port for the second app, you also need to specify a new port for live reload and dev logger or they will conflict with the first app:
ionic serve -p 8101 -r 8102 --dev-logger-port 8103
Otherwise, you'll get connection error. Make sure firewall allows all those ports you use.
ionic serve -p 9000
or
ionic serve --port 9000
simple
ionic serve --external --host="0.0.0.0" --port="8132"
that works for me (im running ionic on docker)
ionic version : 4.7.1
ionic cli version : 5.4.16
according to the issue tracker from the ionic team.. running commands like
ionic cordova run browser --port 8080
currently dont work, it seems to be a known issue and needs to be fixed within some cli version, not sure when this will be
https://github.com/ionic-team/ionic-cli/issues/2307
https://github.com/ionic-team/ionic-cli/issues/2312
you can also specify port and run in lab version using this command:
ionic serve -l --port 2020
This worked for me:
ionic serve -p 8200 -i 35730

Resources