I tried everything to setup environment variables such as ~/.bash_profile
, ~/.zshrc
and vim
but none of it worked in N8N. When I attempt to execute the commands “env” or “echo $WORKFLOWS_DEFAULT_NAME” in the Terminal, the variable I had previously set is displayed.
I also attempted installing PM2 but it’s not running properly anymore.
You could take n8n out of it and just see if your npm/typescript environment will recognize the env vars the way you are setting them.
testenv.ts
console.log(`env ${process.env.ABC}`)
Commands
- Check without env var set
npx ts-node -O '{"module": "commonjs"}' ./testenv.ts
- Output:
env undefined
- Check with env var set
export ABC=envvarvalueset
npx ts-node -O '{"module": "commonjs"}' ./testenv.ts
- Output:
env envvarvalueset