如何解决../node_modules/nativescript-plugin-firebase/firebase.js
我正在开发具有Nativescript Angular和代码共享功能的应用程序。几天前升级到Angular 10后,一切正常。今天,我想使用插件nativescript-plugin-firebase来实现Firebase,但是当我尝试运行我的应用程序时,出现以下错误:
ERROR in ../node_modules/nativescript-plugin-firebase/firebase.js
Module not found: Error: Can't resolve 'tns-core-modules/application/application'
ERROR in ../node_modules/nativescript-plugin-firebase/messaging/messaging.js
Module not found: Error: Can't resolve 'tns-core-modules/application/application'
ERROR in ../node_modules/nativescript-plugin-firebase/admob/admob.js
Module not found: Error: Can't resolve 'tns-core-modules/platform/platform'
ERROR in ../node_modules/nativescript-plugin-firebase/messaging/messaging.js
Module not found: Error: Can't resolve 'tns-core-modules/platform/platform'
我认为它是由Webpack抛出的,因为它是在Webpack编译期间记录的。 我的package.json看起来像这样:
{
"name": "application-name","nativescript": {
"id": "my.nativescript.app","tns-ios": {
"version": "6.5.2"
},"tns-android": {
"version": "6.5.3"
}
},"version": "0.0.0","scripts": {
// some scripts
},"dependencies": {
"@angular/animations": "~10.0.0","@angular/common": "~10.0.0","@angular/compiler": "~10.0.0","@angular/core": "~10.0.0","@angular/forms": "~10.0.0","@angular/platform-browser": "~10.0.0","@angular/platform-browser-dynamic": "~10.0.0","@angular/router": "~10.0.0","@nativescript/angular": "~10.0.0","@nativescript/core": "rc","@nativescript/theme": "~2.2.1","core-js": "^2.6.9","nativescript-plugin-firebase": "^10.5.2","reflect-metadata": "~0.1.12","rxjs": "~6.5.5","tslib": "1.10.0","zone.js": "~0.10.2"
},"devDependencies": {
"@angular-devkit/build-angular": "~0.1000.2","@angular/cli": "~10.0.0","@angular/compiler-cli": "~10.0.0","@nativescript/tslint-rules": "~0.0.5","@nativescript/webpack": "~2.0.0","@types/jasmine": "~3.5.0","@types/jasminewd2": "~2.0.3","@types/node": "^12.11.1","codelyzer": "^6.0.0","jasmine-core": "~3.5.0","jasmine-spec-reporter": "~4.2.1","karma": "~4.4.1","karma-chrome-launcher": "~3.1.0","karma-coverage-istanbul-reporter": "~2.1.0","karma-jasmine": "~3.0.1","karma-jasmine-html-reporter": "^1.4.2","node-sass": "^4.7.1","protractor": "~5.4.3","tns-platform-declarations": "^6.5.15","ts-node": "~8.3.0","tslint": "^5.20.1","typescript": "~3.9.0"
}
}
只是为了了解错误,我尝试将上述文件中的导入更改为tns-core-modules/application
,依此类推。编译工作正常,但是当我在模拟器上启动该应用程序后,该应用程序崩溃了。我也尝试过@nativescript/core/application/application
。我遇到了同样的错误。
我不知道如何解决此问题,因此,我将不胜感激。
解决方法
我能够使用“ @ nativescript / firebase”:“ ^ 11.0.0-rc.0”解决它。 从@ nativescript / firebase导入*作为Firebase
检查此链接: https://nativescript.org/blog/nativescript-7-compatible-plugins/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。