I need to put this node.js module into Alloy project. It's a Facebook SDK node module.
I put the install command, and a node_module folder appear into my project folder, but I can't use it.
Where have I to put this node_module folder? Why the requires into facebook.js are not founded by the compiler?
Please, can anyone help me?
Titanium is not a pure NodeJS environment. When you use require('test')
in a Titanium Alloy project, it will look for a file named test.js
in the directory <Your project>/app/lib/
.
Titanium can't handle a require
on a directory with a package.json
.
So if you want a pure NodeJS
module, you'll have to put every files needed in the <Your project>/app/lib/
directory.
But keep in mind that you can't use a NodeJS module which depends on NodeJS API like requests, because there's no such things in Titanium (you have to Ti.HttpClient instead).