Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5077] Ti 6.x cannot install full nodejs module

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionNeeds more info
Resolution Date2017-08-29T19:30:04.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsnpm, titanium, web3
ReporterJoseph Sachs
AssigneeShak Hossain
Created2017-07-11T20:13:39.000+0000
Updated2017-10-14T18:50:50.000+0000

Description

I am trying (really hard) to install a fairly important npm package. I would like to install *web3* into my mobile App project. (uses core node.js modules) However I am having issues with accessing it without having a bunch of red screens saying "couldn't find module: url for architecture: x86_64". I tried to manually update the paths etc; What I've done is in my App folder: {noformat} npm install web3 {noformat} Then I see the node_modules folder in my App directory... however, I am not able to require the module in my index.js file with a simple:
var Web3 = require('web3'); // throws error
var web3 = new Web3();

function doClick(e) {
    var version = web3.version.api;
    $.label.text = "Web3 version: " + version;
}

$.index.open();
Now I've pasted the folder from the node_modules into a lib I created under App folder, and tried to access the dist within that to access web3.min, then tried a whole lot of other things, with no luck... has anybody else had such issue or have a solution? Adam Paxtom has mentioned that: "The Node.js support, at least currently, appears to be best suited for standalone js libraries." I hope there isn't much need for convincing this issue aught to be a high priority.

Comments

  1. Joseph Sachs 2017-07-27

    Hi Guys, Any update on this issue? At the very least is there a way to +npm install web3.js *in the mean time*+ *if *the ability to install full npm modules *will take time* to be part of Titanium?
  2. Sharif AbuDarda 2017-07-31

  3. Sharif AbuDarda 2017-08-22

    Let us know if you still facing the issue.
  4. Joe Falcone 2017-10-14

    We've just started trying to use Node modules with SDK 6 and we are also running into similar problems. The only examples I can find out there are people who have given up trying to using the Node modules and just included the .js files from the modules and their dependencies into Resources which defeats the purpose of using Node modules in the first place. Several people have asked where exactly to install the Node modules in the source hierarchy (with and without Alloy) and I've seen no answers other than read the documentation which is obtuse to say the least. I would suggest that Titanium provide a genuine example using a real Node module from NPM which would provide a clear answer to all of us.

JSON Source