I am assuming that you used command=ls to get the dependencies and you see an empty object { }, right?
Do you have a package.json in your node resources?
If no, this is the first thing that you need to be able to execute any of the npm commands.
Create a new package.json file by doing the following
- Go to develop tab of your proxy
- Click New → New Script
- Select File Type as “Node” and give a script name as “package.json” (without the quotes)
- Click Add
- Check that there is a package.json file under Scripts → Node.js
Now declare the needed dependencies in this file.
You can use the following sample to add your dependency. In this case, I have added the module sleep.
{
"dependencies" : {
"sleep": ""
}
}
Now when you run the management API with “command=ls”, you will get notified that the dependency sleep is missing.
Now you can run the API with “command=install”, and the latest version of this module will be downloaded and installed.
Once you have installed the modules using the management API, please redeploy the proxy to be sure that the new modules are being picked up by Node.
If you wish to do any changes to the dependencies or add/remove modules, then do the changes in the package.json file and then run the respective npm command.
The supported commands are [dedupe, install, ls, outdated, prune, update]
Hope this answers your question @Maruti Chand.