【问题标题】:Cannot find module '@angular/core' + ionic 3找不到模块'@angular/core' + ionic 3
【发布时间】:2018-10-08 13:50:23
【问题描述】:

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

我已经开始遇到与 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

错误日志:

当我运行 ionic cordova 运行浏览器

 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.

当我运行 ionic serve

而且,这是来自控制台:

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.

【问题讨论】:

  • 确切的错误日志是什么?
  • 我已更新问题以包含运行“ionic cordova run browser”和“ionic serve”时的错误日志。谢谢
  • 看起来 angularfire2 正在抛出它.. 哪个版本?我在 package.json 中没有看到它
  • 另外请将错误日志粘贴为文本而不是图像

标签: cordova ionic3


【解决方案1】:

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

更多详情请参考本帖::github.com/angular/angularfire2/issues/1385

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

【讨论】:

    猜你喜欢
    • 2019-02-15
    • 2018-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-01
    • 2016-09-25
    相关资源
    最近更新 更多