Hi David,
Unfortunately, using npm install (and then ‘require()’) is currently not supported.
We are aware of the importance of that feature.
Meanwhile, consider trying a RESTful API (which is more similar to what you did with the pictures).
You can search the web for such APIs, but here’s an example I just found, could be enough for you.
I hope it helps, let me know how that works.
Liran.