I tried to load a module (called 'moment') into the function node. Following the official documentation, I loaded it into settings.js file by adding: moment:require('/usr/lib/node_modules/node-red/node_modules/moment/moment.js')
to the functionGlobalContext property. Then tried to load it into the function node through: moment = global.get('moment.js');
but i keep getting the error:
"TypeError: moment is not a function"
Thanks for getting back so fast.
I think you misunderstood what i did, let me clarify it:
I have the node-red-contrib-moment module installed in my palette, but to mention it inside the function node I had to follow the following instructions (you might need to scroll down): Using the functionGlobalContext option
Within the function node i mentioned:
moment = global.get('moment');
today = moment(Date()).format('M/D/YY');
Within my settings.js file, i have the following uncommented: