Using the -g option is not something that is directly supported, You will need to run the npm i command from inside the n8n node_modules directory (/usr/local/lib/node_modules/n8n) although this would depend on how you have n8n installed.
You also need to make sure the NODE_FUNCTION_ALLOW_EXTERNAL environment variable is set.
Fantastic so is it working now? The last 2 issues with external librarys not working has been down to the environment variable not being set correctly.
EDIT
Looks like this was because the wrong ecosystem.config.js file was loaded when I did a reboot after the update (Apache was hanging and couldn’t get it to act right) which loaded the old ecosystem.config.js file instead of the correct one. All is good now.
I just updated to 0.199.0 and now I get an error in my function nodes that are using the uuid external library. The error looks like this:
I double checked and the external library is listed in the ecosystem file: