2

I am trying to create a Facebook Oauth System for my NativeScript Android App.I have installed nativescript-oauth from my app's folder directory like this-

tns plugin add nativescript-oauth

Inside my node_modules folder a "nativescript-oauth" folder has been created and dependency also has been updated in composer.json.

In my App.js file,I add this-

    var applicationModule = require("application");
    var tnsOAuthModule = require("nativescript-oauth");
    applicationModule.start({ moduleName: "views/login/login" });

But I am getting this error- Failed to find module:"nativescript:oauth",relative to: /app/tns_modules/

I have also tried this-

import * as tnsOAuthModule from ‘nativescript-oauth’;

But No luck.I am getting another error.What can I do?

Asm Arman
  • 359
  • 6
  • 24
  • In case your are using NativeScript `template-hello-world-ts` template you should be able to import the module like this `import * as tnsOAuthModule from 'nativescript-oauth';` You could also try to remove `platforms` `node_modules`, `hooks` and `lib` folders and to try to rebuild your folder – Nikolay Tsonev Oct 11 '16 at 10:22
  • Please give a full answer.Suggestion in comment is not appreciated.I don't use that template. – Asm Arman Oct 11 '16 at 13:19
  • You could review the plugin demo project - https://github.com/alexziskind1/nativescript-oauth/tree/master/demo . In case you are using vanilla JavaScript for your app the correct way to insert module in your project is `var tnsOAuthModule = require("nativescript-oauth");`. The given information is not enough to be able to reproduce you problem. You could give sample project or to describe steps, how to reproduce your issue. – Nikolay Tsonev Oct 11 '16 at 13:40
  • Ok Sir,I have mentioned that I tried just as like you say.But it didn't work. – Asm Arman Oct 11 '16 at 13:50
  • If you want,I can share further steps.But I think you don't need that. – Asm Arman Oct 11 '16 at 13:53
  • Verify whether this is not something related with your project. You could create clear project with `tns create `. Add the plugin with `tns plugin add nativescript-oauth`. Then try to `require` the plugin with `var tnsOAuthModule = require("nativescript-oauth");` in your `app.js` file. – Nikolay Tsonev Oct 11 '16 at 14:04
  • I have done this as like you say.And I.also search the project which you have provided. – Asm Arman Oct 11 '16 at 14:06
  • Hi Asm, the nativescript-oauth plugin has been updated. Please get the latest from npm and see if that helps out. – Alex Ziskind Jan 04 '17 at 17:39

0 Answers0