This guide is pretty useful:
https://docs.mendix.com/howto/extensibility/create-native-javascript-action
See step 3.5, all you need to do is go to the folder and do npm install. This’ll create the node_modules folder where your dependencies will reside. You can then use those in your javascript actions.
Voila!