EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 448 forks source link

Help! Error: Can't resolve 'tns-core-modules/application/application' #1675

Open Proton-V opened 3 years ago

Proton-V commented 3 years ago

ERROR in ../node_modules/nativescript-plugin-firebase/messaging/messaging.js Module not found: Error: Can't resolve 'tns-core-modules/application/application' in 'C:\Users\User\NativeScript\LuckyWild\node_modules\nativescript-plugin-firebase\messaging' @ ../node_modules/nativescript-plugin-firebase/messaging/messaging.js 5:18-69 @ ../node_modules/nativescript-plugin-firebase/firebase.js @ ./app.js

i change application/application to application , but it didnt work!! What is it?

qasim483 commented 3 years ago

If you are using nativescript version 7 then do it like import * as application from "@nativescript/core/application";

Proton-V commented 3 years ago

Build goot, but i have other ERROR after run! System.err: TypeError: view_base_1.makeValidator is not a function System.err: File: (file: node_modules\nativescript-plugin-firebase\mlkit\facedetection\facedetection-common.js:15:0) System.err: System.err: StackTrace: System.err: (file: node_modules\nativescript-plugin-firebase\mlkit\facedetection\facedetection-common.js:15:0) System.err: at ../node_modules/nativescript-plugin-firebase/mlkit/facedetection/facedetection-common.js(file:///data/data/org.nativescript.LuckyWild/files/app/vendor.js:62166:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at fn(file: app\webpack\bootstrap:120:0) System.err: at (file: node_modules\nativescript-plugin-firebase\mlkit\facedetection\index.android.js:4:29) System.err: at ../node_modules/nativescript-plugin-firebase/mlkit/facedetection/index.js(file:///data/data/org.nativescript.LuckyWild/files/app/vendor.js:62300:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at fn(file: app\webpack\bootstrap:120:0) System.err: at (file: node_modules\nativescript-plugin-firebase\mlkit\index.js:7:20) System.err: at ../node_modules/nativescript-plugin-firebase/mlkit/index.js(file:///data/data/org.nativescript.LuckyWild/files/app/vendor.js:62519:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at fn(file: app\webpack\bootstrap:120:0) System.err: at (file: node_modules\nativescript-plugin-firebase\firebase-common.js:10:12) System.err: at ../node_modules/nativescript-plugin-firebase/firebase-common.js(file:///data/data/org.nativescript.LuckyWild/files/app/vendor.js:58606:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at fn(file: app\webpack\bootstrap:120:0) System.err: at (file: node_modules\nativescript-plugin-firebase\firebase.android.js:7:24) System.err: at ../node_modules/nativescript-plugin-firebase/firebase.js(file:///data/data/org.nativescript.LuckyWild/files/app/vendor.js:61102:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at fn(file: app\webpack\bootstrap:120:0) System.err: at (file:///data/data/org.nativescript.LuckyWild/files/app/bundle.js:107:86) System.err: at ./app.js(file:///data/data/org.nativescript.LuckyWild/files/app/bundle.js:197:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at checkDeferredModules(file: app\webpack\bootstrap:43:0) System.err: at webpackJsonpCallback(file: app\webpack\bootstrap:30:0) System.err: at (file:///data/data/org.nativescript.LuckyWild/files/app/bundle.js:2:57) System.err: at require(:1:266) System.err: System.err: System.err: TypeError: view_base_1.makeValidator is not a function System.err: System.err: StackTrace: System.err: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function System.err: TypeError: view_base_1.makeValidator is not a function System.err: File: (file: node_modules\nativescript-plugin-firebase\mlkit\facedetection\facedetection-common.js:15:0) System.err: System.err: StackTrace: System.err: (file: node_modules\nativescript-plugin-firebase\mlkit\facedetection\facedetection-common.js:15:0) System.err: at ../node_modules/nativescript-plugin-firebase/mlkit/facedetection/facedetection-common.js(file:///data/data/org.nativescript.LuckyWild/files/app/vendor.js:62166:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at fn(file: app\webpack\bootstrap:120:0) System.err: at (file: node_modules\nativescript-plugin-firebase\mlkit\facedetection\index.android.js:4:29) System.err: at ../node_modules/nativescript-plugin-firebase/mlkit/facedetection/index.js(file:///data/data/org.nativescript.LuckyWild/files/app/vendor.js:62300:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at fn(file: app\webpack\bootstrap:120:0) System.err: at (file: node_modules\nativescript-plugin-firebase\mlkit\index.js:7:20) System.err: at ../node_modules/nativescript-plugin-firebase/mlkit/index.js(file:///data/data/org.nativescript.LuckyWild/files/app/vendor.js:62519:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at fn(file: app\webpack\bootstrap:120:0) System.err: at (file: node_modules\nativescript-plugin-firebase\firebase-common.js:10:12) System.err: at ../node_modules/nativescript-plugin-firebase/firebase-common.js(file:///data/data/org.nativescript.LuckyWild/files/app/vendor.js:58606:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at fn(file: app\webpack\bootstrap:120:0) System.err: at (file: node_modules\nativescript-plugin-firebase\firebase.android.js:7:24) System.err: at ../node_modules/nativescript-plugin-firebase/firebase.js(file:///data/data/org.nativescript.LuckyWild/files/app/vendor.js:61102:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at fn(file: app\webpack\bootstrap:120:0) System.err: at (file:///data/data/org.nativescript.LuckyWild/files/app/bundle.js:107:86) System.err: at ./app.js(file:///data/data/org.nativescript.LuckyWild/files/app/bundle.js:197:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at checkDeferredModules(file: app\webpack\bootstrap:43:0) System.err: at webpackJsonpCallback(file: app\webpack\bootstrap:30:0) System.err: at (file:///data/data/org.nativescript.LuckyWild/files/app/bundle.js:2:57) System.err: at require(:1:266) System.err: System.err: System.err: TypeError: view_base_1.makeValidator is not a function System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6309) System.err: at android.app.ActivityThread.access$1200(ActivityThread.java:241) System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1807) System.err: at android.os.Handler.dispatchMessage(Handler.java:106) System.err: at android.os.Looper.loop(Looper.java:214) System.err: at android.app.ActivityThread.main(ActivityThread.java:7156) System.err: at java.lang.reflect.Method.invoke(Native Method) System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975) System.err: Caused by: com.tns.NativeScriptException: Error calling module function System.err: TypeError: view_base_1.makeValidator is not a function System.err: File: (file: node_modules\nativescript-plugin-firebase\mlkit\facedetection\facedetection-common.js:15:0) System.err: System.err: StackTrace: System.err: (file: node_modules\nativescript-plugin-firebase\mlkit\facedetection\facedetection-common.js:15:0) System.err: at ../node_modules/nativescript-plugin-firebase/mlkit/facedetection/facedetection-common.js(file:///data/data/org.nativescript.LuckyWild/files/app/vendor.js:62166:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at fn(file: app\webpack\bootstrap:120:0) System.err: at (file: node_modules\nativescript-plugin-firebase\mlkit\facedetection\index.android.js:4:29) System.err: at ../node_modules/nativescript-plugin-firebase/mlkit/facedetection/index.js(file:///data/data/org.nativescript.LuckyWild/files/app/vendor.js:62300:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at fn(file: app\webpack\bootstrap:120:0) System.err: at (file: node_modules\nativescript-plugin-firebase\mlkit\index.js:7:20) System.err: at ../node_modules/nativescript-plugin-firebase/mlkit/index.js(file:///data/data/org.nativescript.LuckyWild/files/app/vendor.js:62519:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at fn(file: app\webpack\bootstrap:120:0) System.err: at (file: node_modules\nativescript-plugin-firebase\firebase-common.js:10:12) System.err: at ../node_modules/nativescript-plugin-firebase/firebase-common.js(file:///data/data/org.nativescript.LuckyWild/files/app/vendor.js:58606:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at fn(file: app\webpack\bootstrap:120:0) System.err: at (file: node_modules\nativescript-plugin-firebase\firebase.android.js:7:24) System.err: at ../node_modules/nativescript-plugin-firebase/firebase.js(file:///data/data/org.nativescript.LuckyWild/files/app/vendor.js:61102:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at fn(file: app\webpack\bootstrap:120:0) System.err: at (file:///data/data/org.nativescript.LuckyWild/files/app/bundle.js:107:86) System.err: at ./app.js(file:///data/data/org.nativescript.LuckyWild/files/app/bundle.js:197:30) System.err: at webpack_require(file: app\webpack\bootstrap:816:0) System.err: at checkDeferredModules(file: app\webpack\bootstrap:43:0) System.err: at webpackJsonpCallback(file: app\webpack\bootstrap:30:0) System.err: at (file:///data/data/org.nativescript.LuckyWild/files/app/bundle.js:2:57) System.err: at require(:1:266) System.err: System.err: System.err: TypeError: view_base_1.makeValidator is not a function System.err: at com.tns.Runtime.runModule(Native Method) System.err: at com.tns.Runtime.runModule(Runtime.java:689) System.err: at com.tns.Runtime.run(Runtime.java:681) System.err: at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21) System.err: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1158) System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6304) System.err: ... 8 more

juanmaa1414 commented 3 years ago

@EddyVerbruggen Can this be checked out? It's possible to use the plugin with NS 7 ? Or we have to downgrade to use it without major issues? 🙂

qasim483 commented 3 years ago

Here is how I had installed it. In my package.json "@nativescript/firebase": "~11.0.0",

In my app.component.ts

import {firebase} from '@nativescript/firebase';

juanmaa1414 commented 3 years ago

@qasim483 Yay, exactly! I've solved in the same way. Preferred to be via CLI: npm i @nativescript/firebase able to run the config hook assistant.

Proton-V commented 3 years ago

System.err: TypeError: firebase.init is not a function System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5944) System.err: at android.app.ActivityThread.-wrap1(Unknown Source:0) System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1726) System.err: at android.os.Handler.dispatchMessage(Handler.java:106) System.err: at android.os.Looper.loop(Looper.java:165) System.err: at android.app.ActivityThread.main(ActivityThread.java:6746) System.err: at java.lang.reflect.Method.invoke(Native Method) System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:477) System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:809) System.err: Caused by: com.tns.NativeScriptException: Error calling module function System.err: TypeError: firebase.init is not a function

Proton-V commented 3 years ago

I use Nativescript js(Only)

Proton-V commented 3 years ago

if i use import {firebase} from '@nativescript/firebase'; I get White screen only! (android)

Mflm commented 3 years ago

Hi @Proton-V .

I have the same problem with JS.

how did you fix it?

Thanks.

Astriaporta commented 3 years ago

@qasim483 thanks

crtn-dev-io commented 3 years ago

Had the same problem, so this is how i solved this :

In your app.component.ts :

var firebase = require('firebase/app');

(Be careful with the '', follow exactly what i type).

I had to install string-replace-loader

npm i string-replace-loader

Then, in your webpack.config.js :

Line 30 for me (facultative)

module.exports = {
  configureWebpack: {
    module: {
      rules: [
        {
          test: /npm\.js$/,
          loader: "string-replace-loader",
          include: path.resolve("node_modules/firebaseui/dist"),
          options: {
            search: "require('firebase/app');",
            replace: "require('firebase/app').default;",
          },
        },
      ],
    },
  },
};

Don't forget in your constructor of the app.component.ts to add this to initialize

if (!firebase.default.apps.length) // Why this ? Cause it gives an error without when push notification
      firebase.default.initializeApp(this.firebaseConfig);

Tell me if it works for you :)

AatiqUrRehman commented 3 years ago

any solution to this?

kenedynpsyh commented 3 years ago

hi, i have problem same with you, how to you solve this problem