yarn does not start in Jhipster generated project - jhipster

My newly installed Jhipster project is runned but doesn't display anything on the browser and when I type,'yarn start' at the project teminal
it threw the exceptions/errors as the following image enter image description here...

As your error trace shows that you are trying to use port 9060 which is already in use by any other process.
Solution 1 : run your application on any other port.
Solution 2 : kill the other process which is running on 9060 currently.**
Solution 2 For linux please use following.
// to find process id of the process running on 9060
sudo netstat -anp | grep 9060
//to kill the process
sudo kill -9 <process id>

Related

Nuxt 3 server does not stop when restarting supervisor job

I have set up a production environment for a nuxt app where the nuxt server gets run through a supervisor job. When the port is not in use this works well. However, if I issue the supervisorctl reload or supervisorctl restart production-frontend commands the previous nuxt server usually fails to exit. This means that when it tries to start the nuxt server again it errors out.
Is there a special trick to get nuxt to work nicely with supervisor or a parameter I can add to the supervisor process so the nuxt server guaranteed shuts down when I restart it? I would rather not have to resort to giving the deploy process the power to kill any previous process that still may be lingering through kill -9 like I now have to do manually.
This is the content of /etc/supervisor/conf.d/production-frontend.conf
[program:production-frontend]
command=/usr/bin/npm start
directory=/var/www/production/frontend
environment=NODE_ENV="production",PORT="3011"
autostart=true
autorestart=true
startretries=10
startsecs=30
user=www-data
stderr_logfile=/var/log/supervisor/production-frontend_error.log
stdout_logfile=/var/log/supervisor/production-frontend_out.log
/var/www/production/frontend contains the .output folder from a npm run build command and a package.json file. npm run start will start the nuxt server with node .output/server/index.mjs.
Whenever the server fails to start the error log shows the following error message:
[nitro] [dev] [uncaughtException] Error: listen EADDRINUSE: address already in use :::3011
Running netstat -pln | grep 3011 shows a still running nuxt server.
As it turns out npm start will run a command
sh -c -- node .output/server/index.mjs
This in turn will start a process
node .output/server/index.mjs
This can be verified with in a shell with the following commands. Note that 191667 is the parent (sh) and 191668 is the nuxt server.
$ netstat -pln | grep 3301
tcp6 0 0 :::3011 :::* LISTEN 191668/node
$ pstree -p 191668
sh(191667)───node(191668)─┬─{node}(191669)
├─{node}(191670)
├─{node}(191671)
├─{node}(191672)
├─{node}(191673)
├─{node}(191674)
├─{node}(191675)
├─{node}(191676)
├─{node}(191677)
└─{node}(191678)
Supervisor will kill the parent process, but not the child process. Instead just run the command directly. In my case running node .output/server.index.mjs is fine. If something is not installed globally you might need to define the entire path to whatever you are trying to run (e.g. ./node_modules/jest/bin/jest this_makes_no_sense_for_supervisor.

Appium Port occupied

I'm trying to learn Appium but I'm already stuck in the beginning.
When I try to start Appium using the terminal I get an error message that looks like this:
Could not start REST http interface listener. The requested port may already be in use. Please make sure there is no other instance of this server running already.
Fatal Error: listen EADDRINUSE: address already in use 0.0.0.0:4723
So I tried to find out what instance is using that port using the statement lsof -i :4723
I found out there is a running node instance that uses this port so I tried to kill the instance with kill -9 PID . After I killed the instance I used lsof -i :4723 again to see if it worked but the node instance was still there but with a new PID. I guess the kill was successful but node just immediately starts a new instance and occupies the port 4237.
Is there anyone who might have an idea what I can try or maybe knows a solution to this problem?
I found a small workaround which works for now but shouldn't be final. When I use kill -9 PID | appium it works because Appium occupies the port immediately after kill got executed.
Thanks for your help in advance
Try running appium on different port appium -p 4725

Hi, I am new to this, Can someone help me how can I fix this?

The error shown with it, no idea to fix this. can someone help?
I am new with this thing.
The error is really clear. The errorcode EADDRINUSE shows that the port you are using for your NodeJS application already is in use. Therefore your NodeJS application can't connect to this port anymore. Close all applications that is using that port or use a port that is not in use.
I see that you are using Nodemon. It's possible that your nodemon process hang. This can be the result of unexpected close of the terminal or errors in your application.
Check all running nodemon processes by using the command:
ps -ef | grep node
And kill the process by using:
sudo kill -9 <PID>

Error response from daemon: driver failed programming external connectivity on endpoint modest_aryabhata

I'm going through this tutorial
making docker image with: docker build -t myapp_back .
and then want to run container with: docker run -p 3000:3000 -d myapp_back
it's simlpe node/express app
But I'm getting an error:
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error
response from daemon: driver failed programming external connectivity
on endpoint wizardly_wescoff
(a7c53e0d168f915f900e3d67ec72805c2f8e4f5e595f6ae3c7fed8e097886a8b):
Error starting userland proxy: mkdir
/port/tcp:0.0.0.0:3000:tcp:172.17.0.2:3000: input/output error.
What's wrong?
my dockerfile:
FROM node:carbon
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ['npm', 'start']
and start in package.json:
"start": "nodemon src/app.js --exec babel-node"
To solve the following error in Windows: just Restart Docker (from tray menu or selecting the 'Restart Docker...' option in Settings/Reset)
Cannot start service YOUR_SERVICE: driver failed programming external connectivity on endpoint ...
Looks like it is a known issue from docker: https://github.com/docker/for-win/issues/573
Try:
disabling "Experimental Features" in the Settings/Daemon menu
restarting docker
stopping all containers.
To stop all containers, run: docker ps -a -q | ForEach { docker stop $_ }
EDIT: Working ShellScript code to Stop All Containers
for a in `docker ps -a -q`
do
echo "Stopping container - $a"
docker stop $a
done
Just restarted my computer and it works now..
I am able to get docker working on my windows 10 pc by resetting docker to the factory defaults. Restarting docker, restarting my machine did not work.
On Mac Mojave, run the following command to find which processes are using the port.
sudo lsof -i #localhost:<port_no>
In my case I was checking port 8080 so I run
sudo lsof -i #localhost:8080
I found that the http-alt is running on port 8080 and after getting the process id using above command you can kill the processes by
sudo kill -9 <process_id>
However, in my case four applications ArtemisSe, Mail, Google and Slack are using http-alt on port 8080. Since they look important applications so I changed my port and run the container on 8888 instead of 8080. i.e.
docker run -it --rm -p 8888:8080 <imageid or image name>
Restarting the computer is not the actual fix, just a workaround, that one would need to be doing on a frequent basis.
The problem is related with the default windows 10 shutdown behaviour.
The actual fix can be achieved disabling windows fast startup settings:
Control Panel -> Power Options -> Choose what the power button does -> Change settings that are currently unavailable -> Toggle Turn on fast startup
I am running under linux. If I run docker as root with the sudo command, it works fine.
Just restart docker, right click on its icon then restart. that solved my problem
In my case, the same error in PHP Container. I solve changing the public port and works.
This command throw error after restart my Windows 10:
docker run -d -p 8080:80 --name php_apache php_app
Solution:
docker run -d -p 8081:80 --name php_apache php_app
Just run this command to stop your all containers
It worked for me.
for a in docker ps -a -q
do
echo "Stopping container - $a"
docker stop $a
done
In some case,restarting your computers solve problem. But it is not really best solution, especially UNIX like operation system.
First of all you should know other process is either running or not in specific port, If you see such port is already in use by other resources. you should kill that procees which running in that port. To do that just follow:
sudo lsof -i #localhost:<port number>
Output looks like this
Command PID USER TYPE SIZE ...
<command> <pid number>
We need pid number which is defines procees id
And then kill that process by its procees id
sudo kill -9 <pid>
After kill that procees you can run your new container in such port as you want

Start and stop a node application using command prompt.

I have created a node application and run it in 3000 port. Now I need to stop/start/restart this application by using command prompt. How can I do it.
Start:node app.js
Stop:Ctrl + C
Restart:node app.js
Better option try Nodemon. Nodemon is a utility that will monitor for any changes in your source and automatically restart your server.
Install nodemon globally npm install nodemon -g
Run the server nodemon app.js
Assuming you are using linux
If you need to stop some application running on some specific port use this and you know the port but not the process id. find the process id like this
netstat -plten | grep LISTEN | grep 3000
this will output some thing like this
tcp 0 0 :::10060 :::* LISTEN 0 20465 3489/node
where 3489 is the process id.
then do
kill -9 3489
to kill the procees
You can simply press 'Ctrl + C' to stop any process in cmd. Also consider using nodemon , its a fantastic tool which automatically restarts your app whenever you save any new changes to the files.

Resources