Describe the issue/error/question
I am trying to make an Axios request inside a function node and it gives the error “ERROR: axios is not defined”
I have reviewed the configuration documentation here
https://docs.n8n.io/hosting/configuration/#use-built-in-and-external-modules-in-function-nodes
I am using NPM & PM2 to manage the running n8n and have added the env variables to the ecosystem.js file. This seems to be working at getting the environment variables into n8n because I can go into a function node and console log the values that were set.
~~ function node ~~
console.log('builtin: ',$env[‘NODE_FUNCTION_ALLOW_BUILTIN’]);
console.log('external: ', $env[‘NODE_FUNCTION_ALLOW_EXTERNAL’]);
~~ output ~~
Node: “Function” builtin: *
Node: “Function” external: axios
from the running folder (n8n) I checked the node_modules folder and confirmed that axios is listed there.
But I am still unable to get the function node to see Axios.
Is there something I am not doing right?
Additionally for troubleshooting purposes I stopped running via pm2 and tried my own startup script:
~~ start.sh ~~
export NODE_FUNCTION_ALLOW_BUILTIN=*
export NODE_FUNCTION_ALLOW_EXTERNAL=axios
n8n
Same result, I can console.log the env variables but it can’t see axios.
Information on your n8n setup
- **n8n version: 0.177.0
- Database you’re using (default: SQLite): SQLite
- Running n8n with the execution process [own(default), main]:
- Running n8n via [Docker, npm, n8n.cloud, desktop app]: NPM & PM2
If you want more info on how I installed n8n you can check this video. UPDATED: Installing N8N (Nodemation) on my server 2022 - YouTube