Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant use custom node_modules with --shadow #526

Open
bert-w opened this issue Mar 9, 2017 · 5 comments
Open

Cant use custom node_modules with --shadow #526

bert-w opened this issue Mar 9, 2017 · 5 comments
Assignees
Labels

Comments

@bert-w
Copy link

bert-w commented Mar 9, 2017

My app contains custom node modules which are installed into the lib directory, including:

app/lib/node_modules/qs which is a querystring module from npm, see https://www.npmjs.com/package/qs .

However when building with --shadow, the runtime appears to be looking for another module:

[DEBUG] [iphone, 10.1, undefined] Native module:node_modules/qs
[ERROR] [iphone, 10.1, undefined] Couldn't find module: node_modules/qs for architecture: x86_64
[ERROR] [iphone, 10.1, undefined] TypeError: undefined is not an object (evaluating '__p.require("node_modules/qs").stringify')

So to reproduce: install this npm package (qs@5.2.0), and call it anywhere in your titanium code using require('node_modules/qs').stringify({foo: 'bar'});.

I can fix it using require('node_modules/qs/lib/index')... (direct reference to the bootstrap file) but I'm quite sure there's an underlying tishadow issue here.

I'm using Ti 6.0.1.GA, Alloy 1.9.5, and npm/qs@5.2.0

@leoafarias
Copy link

Same issue here All the modules on the lib folder are giving me a native module error

@dbankier
Copy link
Owner

dbankier commented Jul 6, 2017

I haven't used node_modules in a project before. I generally import a compiled lib directly.
I would need to modify the custom require.
It is on the TODO list.

@dbankier dbankier self-assigned this Jul 6, 2017
@dbankier dbankier added the bug label Jul 6, 2017
@leoafarias
Copy link

@dbankier I dont think this is node_modules related, as I dont use node_modules. I think it has to do with the subfolder structure on the lib folder. so I have a folder called lib/something/somethingelse.js, and it says that "something" is not a native module

@caspahouzer
Copy link

Do we have news for this task? :-)

@Jei
Copy link

Jei commented May 30, 2018

I'm trying to include Jasmine as a node module inside my app and I'm having the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants