lstanczak
lstanczak

Reputation: 13

Error importing nativescript-oauth2 into nativescript vue project

In nativescript vue.js project I installed nativescript-oauth2 by npm install nativescript-oauth2.

Later I'm trying import nativescript-oauth2 package into project file by import { TnsOAuthClient, configureTnsOAuth } from 'nativescript-oauth2';.

When I'm building application I get following error.

ERROR in ./auth/auth-service.js
Module not found: Error: Can't resolve 'nativescript-oauth2' in 'C:\repo\digitaltjagttegn-mobileapp\app\auth'
@ ./auth/auth-service.js 2:0-72
@ . sync (?<!\bApp_Resources\b.*)(?<!\.\/\btests\b\/.*?)\.(xml|css|js|kt|(?<!\.d\.)ts|(?<!\b_[\w-]*\.)scss)$
@ ./main.js`

I would be great if someone will give me some hint of what to do with it

I've removed hooks, platforms and node_modules folders and rebuild with the same result.

For example import { isAndroid, isIOS } from 'tns-core-modules/platform'; in the same file working good.

Thank you for help in advance.

Upvotes: 1

Views: 156

Answers (1)

Deeh
Deeh

Reputation: 347

Downgrading to version 2.4.0 of nativescript-oauth2 seems to fix this issue.

Comparing the source from both versions it appears that version 2.4.1 is missing a lot of .js files in the source that version 2.4.0 has:

pkce-util.android.js
pkce-util.ios.js
tns-oauth-auth-state.js
tns-oauth-client-connection.js
tns-oauth-login-sub-controller.js
tns-oauth-login-webview-controller.js
tns-oauth-native-view-controller.android.js
tns-oauth-native-view-controller.ios.js
tns-oauth-utils.js

Upvotes: 0

Related Questions