I have just tried this on a fresh version of CentOS 8 using the latest available Node.js version coming with CentOS.
To be precise, I have only entered these commands after my test VM has been provisioned:
sudo su -
dnf module list nodejs
dnf module enable nodejs:16
dnf install nodejs
npx n8n
I then had to confirm the prompt:
Need to install the following packages:
n8n
Ok to proceed? (y) y
Afterwards, n8n would start up as expected:
Initializing n8n process
UserSettings were generated and saved to: /root/.n8n/config
INFO: Started with migration for wait functionality.
Depending on the number of saved executions, that may take a little bit.
Start migration UpdateWorkflowCredentials1630330987096
UpdateWorkflowCredentials1630330987096: 1.713ms
n8n ready on 0.0.0.0, port 5678
Version: 0.157.1
Editor is now accessible via:
http://localhost:5678/
Press "o" to open in Browser.
So I am wondering if the problem might be specific to your Node.js installation. Are you by any chance using a version that didn’t come with the operating system? Or have different versions of Node.js installed (and might face a situation where modules would be stored in a different location than where the Node.js version used by your npx command is looking)?
The “Beginners”-question. Next day after installing with “npx n8n” I try to open http://localhost:5678/ (where "localhost is my server IP). Not functining.
When I type n8n in shell, response is "-bash: n8n: command not found ". And when I start “npx n8n”, it runs again.
Hi @Dimitri_Korenev, as you have noticed npx is not a permanent solution but a “package runner”. It’s great for quickly testing stuff, but it will not set anything up permanently.
The suggested approach for a server installation would be using Docker (which means you also wouldn’t have to worry about configuring Node.js on your machine) and is documented here:
Thank you; slowly moving forward. When I enter “docker-compose up -d”, I get error message
Can’t find a suitable configuration file in this directory or any
parent. Are you in the right directory?
So I wouldn’t have the .env file and docker-compose.yml in that directory I would probably make a /root/docker/ folder or something like that and put the files in there as the container itself has access to that directory.
To actually answer your issue though I suspect you are running the command from a different folder so you would first need to change into the directory that contains the file and run the command from there. Based on your current setup it would be something like…
Thank you! Done according to instruction. Now getting following error (what it do?):
[[email protected] .n8n]# docker-compose up -d
Creating network “n8n_default” with the default driver
Pulling traefik (traefik:)…
latest: Pulling from library/traefik
97518928ae5f: Pull complete
8f1084cd7998: Pull complete
7f585f616a11: Pull complete
c4f598fe2b15: Pull complete
Digest: sha256:2f603f8d3abe1dd3a4eb28960c55506be48293b41ea2c6ed4a4297c851a57a05
Status: Downloaded newer image for traefik:latest
Creating n8n_traefik_1 …
Creating n8n_traefik_1 … error
WARNING: Host is already in use by another container
ERROR: for n8n_traefik_1 Cannot start service traefik: driver failed programming external connectivity on endpoint n8n_traefik_1
(b7c40646fb7ed1f82ed4a6141fcd9330c3889b984b6d30f7b388f667fb2ff277): Error starting userland proxy: listen tcp4 0.0.0.0:443: bind
Creating n8n_n8n_1 … done
ERROR: for traefik Cannot start service traefik: driver failed programming external connectivity on endpoint n8n_traefik_1 (b7c4
0646fb7ed1f82ed4a6141fcd9330c3889b984b6d30f7b388f667fb2ff277): Error starting userland proxy: listen tcp4 0.0.0.0:443: bind: addr
ess already in use
ERROR: Encountered errors while bringing up the project.
[[email protected] .n8n]# docker-compose stop
Stopping n8n_n8n_1 … done
[[email protected] .n8n]# docker-compose up -d
Starting n8n_traefik_1 …
Starting n8n_traefik_1 … error
WARNING: Host is already in use by another container
ERROR: for n8n_traefik_1 Cannot start service traefik: driver failed programming external connectivity on endpoint n8n_traefik_1
(311cfa3c70ef37424df7119ce1e26cde29c047ce846e85a7bcb2abedfae14098): Error starting userland proxy: listen tcp4 0.0.0.0:443: bind
Starting n8n_n8n_1 … done
ERROR: for traefik Cannot start service traefik: driver failed programming external connectivity on endpoint n8n_traefik_1 (311c
fa3c70ef37424df7119ce1e26cde29c047ce846e85a7bcb2abedfae14098): Error starting userland proxy: listen tcp4 0.0.0.0:443: bind: addr
ess already in use
ERROR: Encountered errors while bringing up the project.
[[email protected] .n8n]#
You have 443 in there so I suspect it could be that as you have Traefik set to bind to all IPs on port 443. Do you know what web service or container you have running that is using that port, Would be worth stopping it to see what happens.
You also have Apache running port 80 which may cause other issues with getting the Lets Encrypt certificate.
I have several sites running on server, so I can not start changing of ports of Apache or Nginx and danger the sites. Stoppign sites to see what happens is not a solution either)))) That are critical applications. What else can I do to run n8n on my server?
Hi Jon, I have no clue what is reverse proxy))) That is server I purchaised for hosting of php, sites etc. So my task is to check how to install n8n to run integration processes))
Which Unix order should I run to answer your question?
It is a bit trickier than that, So the first thing you could try is to change the Traefik ports but if you are running multiple sites I would imagine you are using virtual hosts or mod proxy.
What you could do is configure an Apache virtual host to act as a proxy and send the requests back to the n8n container. Then you can remove the Traefik part from your compose file and you can then handle your SSL certs in whatever way you normally would.
As an example your Apache virtual host may look something like the below (untested - I am not that familiar with Apache).
Jon, thank you, but I am not a programmer, and have no clue what you mean. Which compose file? Thich Apache confoguration file??? Are there any functioning instructions???
I assume this is not the first case where people wanna install n8n on their own server))) So can you please provide functioning instruction how can I install n8n on my server???
Your colleague MutedJam suggested to user Docker according to documentation, but this approach fully fails! Before I tried to use npx. Other alternative is to use npm?
What is functioning??? Or if you suggest to manipulate Apache, where can I find instructions (which files, where to find, etc)?
You are correct it is not the first time someone wants to install n8n on their server but every server is different just like your desktop machine or laptop will be configured in a different way to mine.
While I would love to give you detailed steps I can only provide a certain level of information as I have no idea how you have your server configured as there are many different ways to do it.
The above suggestion will work but it does come with a general assumption that you know where your servers configuration files are for what you have already set up.
When you configure everything for the existing sites do you remember what you installed and where the config files are? Normally it would be something like /etc/apache2/sites-available but if you used docker for your web server that would be different.
The docker-compose file would be under /root/.n8n unless you moved it as suggested previously.
If you are able to provide more information on how you setup what you have now I may be able to provide more information.