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

Module not found: Error: Can't resolve 'nativescript-oauth2' #126

Open
andresilva-cc opened this issue Jul 17, 2020 · 2 comments
Open

Module not found: Error: Can't resolve 'nativescript-oauth2' #126

andresilva-cc opened this issue Jul 17, 2020 · 2 comments

Comments

@andresilva-cc
Copy link

Make sure to check the demo app(s) for sample usage

Make sure to check the existing issues in this repository

If the demo apps cannot help and there is no issue for your problem, tell us about it

When running the project with the same auth-service.js file from the Vue demo, the following error is shown:

ERROR in ./services/auth.js
Module not found: Error: Can't resolve 'nativescript-oauth2' in '/home/andreluiz/Projetos/***/***/app/app/services'
 @ ./services/auth.js 5:28-58
 @ ./main.js

ERROR in ./services/auth.js
Module not found: Error: Can't resolve 'nativescript-oauth2/providers' in '/home/andreluiz/Projetos/****/***/app/app/services'
 @ ./services/auth.js 7:18-58
 @ ./main.js

I tried with a clean build (removing node_modules and platforms) and the error still happens.

Which platform(s) does your issue occur on?

  • Android (didn't test on iOS yet)
  • Android 7.1.1
  • Emulator

Please, provide the following version numbers that your issue occurs with:

  • CLI: 6.1.2
  • Cross-platform modules: 6.5.8
  • Runtime(s): 6.5.0
  • Plugin(s):
  "dependencies": {
    "@nstudio/nativescript-loading-indicator": "^3.0.4",
    "@vue/devtools": "^5.3.3",
    "axios": "^0.19.2",
    "get-age": "^1.0.1",
    "moment": "^2.27.0",
    "moment-timezone": "^0.5.31",
    "nativescript-camera": "^4.5.0",
    "nativescript-dna-deviceinfo": "^2.4.3",
    "nativescript-local-notifications": "^4.2.1",
    "nativescript-localize": "^4.2.1",
    "nativescript-oauth2": "^2.4.1",
    "nativescript-pdf-view": "^2.2.0",
    "nativescript-photoviewer": "^2.1.5",
    "nativescript-slides": "^2.3.0",
    "nativescript-socketio": "^3.3.1",
    "nativescript-toasty": "^3.0.0-alpha.2",
    "nativescript-ui-dataform": "^6.1.0",
    "nativescript-ui-listview": "^8.2.0",
    "nativescript-vue": "^2.6.1",
    "nativescript-vue-devtools": "^1.4.0",
    "nativescript-youtubeplayer": "^3.0.1",
    "tns-core-modules": "^6.5.1",
    "vuex": "^3.4.0"
  },
  "devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/preset-env": "^7.0.0",
    "babel-loader": "^8.1.0",
    "eslint": "^6.8.0",
    "eslint-config-airbnb-base": "^14.1.0",
    "eslint-plugin-import": "^2.21.1",
    "eslint-plugin-vue": "^6.2.2",
    "nativescript-dev-webpack": "^1.5.1",
    "nativescript-vue-template-compiler": "^2.6.0",
    "nativescript-worker-loader": "~0.11.0",
    "node-sass": "^4.13.1",
    "vue-loader": "^15.9.1"
  }

Please, tell us how to recreate the issue in as much detail as possible.

  1. Install nativescript-oauth2 with npm install nativescript-oauth2 --save
  2. Create a file named auth.js with the same contents from this file from NativeScript-Vue demo
  3. Import auth.js file in main.js
  4. Run the app with tns run android

Is there any code involved?

The code is the same from the demo, as mentioned above.

@andresilva-cc
Copy link
Author

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

@dscirto
Copy link

dscirto commented Jul 20, 2020

I can confirm that this happens to me as well with 2.4.1. Downgrading to 2.4.0 also worked.

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

No branches or pull requests

2 participants