N8n auto exits after closing terminal

Installed n8n on the server ubuntu 18.04 npm, the server starts and works normally. But after setting up, when I want to exit the terminal without completing the n8n process, the process ends after closing itself. How to fix it ?

Worth checking out this topics:

I think that you are using n8n without a docker

In that case, this topic is really helpful

I use it on my own installation and works perfectly well

2 Likes

Great thing, but I am working through the tunnel, the flag - the tunnel did not work

Hi,

A standard unix way of doing such things would be something like that:

pm2 start n8n -- --tunnel

when anything after “–” parameter is passed to the script

You might want to try it

Also, this explains what double dash is doing

Regards,
Igor

3 Likes

Thanks for the plug, @mihha! :grin:

Not a problem at all. Glad I could help

The program is very useful, but I started having problems here too.
Does it work fine with the argument? Without an argument, it starts the tunnel.


The log in pm2 looks like this, I see that the argument does not fit.
PM2 | App [n8n:4] exited with code [0] via signal [SIGINT]
PM2 | App [n8n:4] starting in -fork mode-
PM2 | App [n8n:4] online
4|n8n | The command “–tunnel” is not known!
4|n8n | n8n Workflow Automation Tool
4|n8n | VERSION
4|n8n | n8n/0.73.1 linux-x64 node-v14.5.0
4|n8n | USAGE
4|n8n | $ n8n [COMMAND]
4|n8n | COMMANDS
4|n8n | execute
4|n8n | start Starts n8n. Makes Web-UI available and starts active workflows
PM2 | App [n8n:4] exited with code [0] via signal [SIGINT]
PM2 | App [n8n:4] starting in -fork mode-
PM2 | App [n8n:4] online
4|n8n | The command “–tunnel” is not known!
4|n8n | n8n Workflow Automation Tool
4|n8n | VERSION
4|n8n | n8n/0.73.1 linux-x64 node-v14.5.0
4|n8n | USAGE
4|n8n | $ n8n [COMMAND]
4|n8n | COMMANDS
4|n8n | execute
4|n8n | start Starts n8n. Makes Web-UI available and starts active workflows
PM2 | App [n8n:4] exited with code [0] via signal [SIGINT]
PM2 | App [n8n:4] starting in -fork mode-
PM2 | App [n8n:4] online
4|n8n | The command “–tunnel” is not known!
4|n8n | n8n Workflow Automation Tool
4|n8n | VERSION
4|n8n | n8n/0.73.1 linux-x64 node-v14.5.0
4|n8n | USAGE
4|n8n | $ n8n [COMMAND]
4|n8n | COMMANDS
4|n8n | execute
4|n8n | start Starts n8n. Makes Web-UI available and starts active workflows
PM2 | App [n8n:4] exited with code [0] via signal [SIGINT]
PM2 | Script /usr/bin/n8n had too many unstable restarts (16). Stopped. “errored”

To be honest, no idea

Maybe you should ask question to the pm2 developers and get back with the solution

Regards,
Igor

Give this a try:

pm2 start n8n --node-args="--tunnel"

Take a look here for more info.

1 Like

It doesn’t work either, here n8n cannot read the argument in pm2. It is very strange why this is so, I have been a lot of things. identical error as above.

I read somewhere (can’t remember the page) that if you want to pass arguments from pm2 to the node application like this, node application needs to check the arguments in a specific way

That is why I suggested to contact pm2 developers and ask them about this

I am not using tunneling so I didn’t really test this. My setup is behind the reverse proxy so I don’t need a tunnel

Regards,
Igor

I have a telegram bot application that uses commands to manage a remote server, a telegram trigger without a tunel does not want to work

Do you have a domain on this server? Maybe you can create a Apache or Nginx proxy so you don’t have to use a tunnel?

fyi: Running n8n with tunnel is also just meant for testing & development. Production deployments should not run through the tunnel.

1 Like

I am now studying nginx,
I’ll try to do through it
Using n8n without tunnel, is it just connecting to ssl site?

1 Like