Nodejs npm Module require Error

I have installed dreamfactory on Azure using the bitnami image. I am creating a service using nodejs. When I am trying to call lodash it gives me error. Even though the files are present in the storage/scripting directory. Anything else I am missing?




Ok I have found the answer. This works



In your screenshot:


The NPM module you’ve required is ‘loadash’, I think const lodash = require('lodash') should be sufficient. I don’t think you need to require the full path. It’s also important to remember to use the -g flag when installing modules to use in DF server side scripts. At least this has been my observation.

@Sasquatch oh that makes perfect sense. I will try that.

I am hosting DF myself, but I am able to use
var lodash = require(“lodash”);
in my scripts without the full path. As long as the library is installed locally, the command for which I do not remember, but probably just ‘npm install lodash’ because it is in a ‘node_modules’ folder at the root of my project. I notice it is also at the ./storage/scripting path as you described. I could not tell you which one it is using.