首页 > 解决方案 > 找不到模块'@angular/core' + ionic 3

问题描述

角度/核心实际上是在正确的位置。这是我第一次面对这个问题。在这种情况下该怎么办?

我已经开始遇到与 FCM(Firebase 云消息传递)集成的问题

这是我的package.json

添加了 "angularfire2": "^5.0.0-rc.6.0", 相同的错误:无法复制这个是离子输出

在此处输入图像描述

所以,我降级了

从 :

 "angularfire2": "^5.0.0-rc.6.0"

至 :

"angularfire2": "5.0.0-rc.3",

和,

从 :

"firebase": "^4.13.1",

至 :

  "firebase": "^4.6.0",

==================================================== ====

{
  "name": "authNotificationTest",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/animations": "5.2.10",
    "@angular/common": "5.2.10",
    "@angular/compiler": "5.2.10",
    "@angular/compiler-cli": "5.2.10",
    "@angular/core": "5.2.10",
    "@angular/forms": "5.2.10",
    "@angular/http": "5.2.10",
    "@angular/platform-browser": "5.2.10",
    "@angular/platform-browser-dynamic": "5.2.10",
    "@ionic-native/core": "4.7.0",
    "@ionic-native/fcm": "^4.7.0",
    "@ionic-native/firebase": "^4.7.0",
    "@ionic-native/splash-screen": "4.7.0",
    "@ionic-native/status-bar": "4.7.0",
    "@ionic/storage": "2.1.3",
    "angularfire2": "^5.0.0-rc.6.0",
    "cordova-browser": "5.0.3",
    "cordova-ios": "4.5.4",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-fcm": "^2.1.2",
    "cordova-plugin-fcm-plus": "git+https://github.com/guyromb/cordova-plugin-fcm-plus.git",
    "cordova-plugin-firebase": "^1.0.2",
    "cordova-plugin-ionic-keyboard": "^2.0.5",
    "cordova-plugin-ionic-webview": "^1.2.1",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "firebase": "^4.13.1",
    "ionic-angular": "3.9.2",
    "ionicons": "3.0.0",
    "rxjs": "5.5.10",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.1.9",
    "typescript": "~2.6.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-fcm": {},
      "cordova-plugin-firebase": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {}
    }
  }
}

这是我的离子信息

cli 包:(/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

全局包:

cordova (Cordova CLI) : 8.0.0

本地包:

@ionic/app-scripts : 3.1.9
Cordova Platforms  : browser 5.0.3 ios 4.5.4
Ionic Framework    : ionic-angular 3.9.2

系统:

Node  : v9.11.1
npm   : 5.6.0
OS    : macOS High Sierra
Xcode : Xcode 9.3 Build version 9E145

环境变量:

ANDROID_HOME : not set

杂项:

backend : pro

错误日志:

当我运行离子科尔多瓦运行浏览器

 Refused to apply style from 'http://localhost:8100/build/main.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
vendor.js Failed to load resource: the server responded with a status of 404 (Not Found)
main.js Failed to load resource: the server responded with a status of 404 (Not Found)
vendor.js Failed to load resource: the server responded with a status of 404 (Not Found)
(index):1 Refused to execute script from 'http://localhost:8100/build/vendor.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
main.js Failed to load resource: the server responded with a status of 404 (Not Found)
(index):1 Refused to execute script from 'http://localhost:8100/build/main.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
(index):1 Refused to apply style from 'http://localhost:8100/build/main.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

当我运行离子服务时

而且,这是来自控制台:

Refused to apply style from 'http://localhost:8100/build/main.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
vendor.js Failed to load resource: the server responded with a status of 404 (Not Found)
main.js Failed to load resource: the server responded with a status of 404 (Not Found)
(index):1 Refused to apply style from 'http://localhost:8100/build/main.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
vendor.js Failed to load resource: the server responded with a status of 404 (Not Found)
(index):1 Refused to execute script from 'http://localhost:8100/build/vendor.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
main.js Failed to load resource: the server responded with a status of 404 (Not Found)
(index):1 Refused to execute script from 'http://localhost:8100/build/main.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
(index):1 Refused to apply style from 'http://localhost:8100/build/main.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

标签: cordovaionic3

解决方案


感谢 Suraj Rao 的评论,您可以在这里找到问题的解决方案: “FirebaseApp 未正确实现”,如下面的屏幕截图所示

在此处输入图像描述

请参阅此线程以获取更多详细信息::github.com/angular/angularfire2/issues/1385

回滚"firebase": "4.8.0"有助于解决上述问题


推荐阅读