Install with npm without root privileges

Hi, how can i install on vps without root using npm?

Hey @Kamil_Bu,

Did you get an error when you tried to install it without using root?

Hi, first tell me please how to uninstall all :smiley:
I will try again without root and ill give You errors.

OK npn uninstall n8n - should uninstall all what “npm install n8n -g” installs? As i see it is not.
From the begginig:

  1. i tried to install n8n from user created to host Your app. I had errors (i do not have its log now) so
  2. i installed is as root
  3. i could use also nvm command to get newer nodejs and install it on root profile, webpage was working, i stopped it
  4. than i wanted to run it as my n8 user and after getting nvm and newer version (v16) it started
  5. now i used npm uninstall n8n as root and it removed ~300 packages but
  6. as n8 user im still able to run your service.

So i want to celan up all (i can go to snapshot eventually) and install manually step by step not using root account, and eliminate/give You errors which i got. To be sure root user is not being used to host n8n.
And additional questions:
How do i manage webcert for n8n, what engine is used to host webpage (i can use my apache already installed on the server for example). How to set up https? What else should i do regarding Your app security?

Hey @Kamil_Bu,

There are a few bits there to go through :slightly_smiling_face:

The first part appears to be more of an NPM issue rather than an n8n issue but to remove I would assume npm uninstall n8n --global would do the job. I would use Node v14.18.0 as well which is the one we suggest to go with for now.

When you use NVM don’t forget it keeps things local to the user so the packages live under ~/.nvm/ so while you remove them from one user if it was installed as a second user they would still exist if you remove it as the first or this is how I believe NVM works anyway.

So to remove the packages I would check the .nvm folders for the users just to make sure there is nothing hiding or remove NVM and install it again if you are not using it for anything else.

For the certificate side of things if you already have a web server running you could use that as a reverse proxy if it supports it and you know how to configure it. If you wanted to do it without using your existing web server you would need to manually obtain a certificate and set 3 environment variables…


You can find these listed on this page: Environment Variables | Docs

While typing this out I have had n8n installing using NVM as a non root user on Ubuntu, To do this I ran the commands below which may help you. The exit was there because it was quicker than running the source command.

[email protected]:~$ history
    1  curl -o- | bash
    2  exit
    3  cd ~
    4  nvm
    5  nvm install 14.18.0
    6  npm install -g n8n
    7  history