After i install n8n globally by command
npm install n8n -g and run by
n8n my variables
not works. But if i start n8n by
npx n8n variables work. How set variables for global install ?
Hi @kostikovmu, welcome to the community
I am afraid I could not reproduce the problem. I tried setting my variables in the way you described and had to provide the configured basic auth credentials to access n8n’s UI.
Just out of curiosity, does it work if you run all these commands in one line? E.g.
export N8N_BASIC_AUTH_ACTIVE=true && export N8N_BASIC_AUTH_USER=test && export N8N_BASIC_AUTH_PASSWORD=123 && n8n. Something in the back of my head tells me I might have seen this before, though possibly not directly related to n8n.
Hi, @MutedJam. Thank you for reply.
Ooops, i was restarting the “old” pm2 process.
If i restart server, will i need export again?
The export command is provided by your shell. With common shells like bash or zsh (and presumably a lot of other shells as well) it will make an environment variable available to all child processes.
So if you run another app in the same session, the variable would still be available. If you start a new session (for example by opening a new terminal window) you would need to export it again.
That said, seeing as you are using PM2, the command would be slightly different. You might want to take a look at this blog post for an example.