Can not find module (when running with pm2)

Hi,

I installed a node module with npm and added
NODE_FUNCTION_ALLOW_EXTERNAL=
to the environment.

When I start n8n with:
node node_modules/.bin/n8n

I can use the module with require.

But once I start it with pm2:
pm2 start node node_modules/.bin/n8n

the module is not available anymore and it says “Can not find module”

Any idea what I missed here ?

Thanks

Hey @passana,

Has the environment variable been added to the pm2 ecosystem file? I am not sure how pm2 handles modules and if it needs anything else to be done.

thanks @Jon . I thought, that pm2 passes all the env from the current session.

with ecosystem file it worked. Thanks for the hint.

1 Like