Plugin from Github seems to cause errors when running app on emulator

android

#1

I am new to NativeScript and I am trying to build an app which talks to the Fitbit Web API. I found the nativescript-oauth plugin. However, as it does not have Fitbit, I thought I will add one. So, I forked the repo at https://github.com/gupta-ankit/nativescript-oauth and used it my applicationhttps://github.com/gupta-ankit/nativeitviz

I added the plugin using the following

tns plugin add git://github.com:gupta-ankit/nativescript-oauth.git

Now, when do tns build android, I do not get any error. However, if I try to do tns run android I get the error

StackTrace:
System.err: Frame: function:‘require’, file:’’, line: 1, column: 266
System.err: Frame: function:’’, file:‘file:///data/data/org.nativescript.nativefitviz/files/app/app.js’, line: 10, column: 22
System.err: Frame: function:‘require’, file:’’, line: 1, column: 266
System.err: Error: com.tns.NativeScriptException: Failed to find module: “nativescript-oauth”, relative to: app/tns_modules/

I also tried adding the original plugin (after removing my fork) by

tns plugin add native-oauth

and this seems to work fine. The error occurs only when I try to use the forked version.

Has anyone else encountered a similar problem before?


#2

The actual plugin in NPM will exclude typescript files, utility scripts, demo projects, and it’s full ready usable code.

But Git may not be or need not to be. If you are customizing a plugin, fork it, make changes, create the release version of plugin may be as a tar file then point that in your package.json instead of whole remote repo.


#3

Thanks Manoj. That makes sense. Sorry, this was probably a newbie question. I am just new to the node and nativescript world.