ionic 3 firebase错误:./ node_modules / firebase / auth / index.js

时间:2017-12-03 18:46:37

标签: cordova firebase cordova-plugins ionic3 angularfire2

我有离子3应用程序,由于某些原因,它没有运行ionic cordova run android

我试图在6.4.06.3.2之间将firebase和@firebase与android一起降级,同时调整了这么多库和依赖项的版本!

这也一直在沙箱项目中进行!我在互联网上搜索它,但这似乎是一个新的错误!

当您阅读错误日志时,您会注意到它正在对Error: Can't resolve '@firebase/auth'中的node_modules/firebase/auth进行重新编号,因此这里是此文件的内容:

require('@firebase/auth'); // only one line, and when I click on it it's pointing to `node_modules/firebase/node_modules/@firebase/auth/dist/auth.js`

ionic info输出:

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

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.2
    Cordova Platforms  : android 6.3.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 25.2.5
    ios-deploy        : 1.9.2
    ios-sim           : 6.1.2
    Node              : v8.9.1
    npm               : 5.2.0
    OS                : macOS High Sierra
    Xcode             : Xcode 9.1 Build version 9B55

Environment Variables:

确切的错误如下:

[21:34:40]  copy finished in 6.73 s
Error: ./node_modules/firebase/auth/index.js
Module not found: Error: Can't resolve '@firebase/auth' in '/Users/Mike/Code/ionic/foo-bar/node_modules/firebase/auth'
resolve '@firebase/auth' in '/Users/Mike/Code/ionic/foo-bar/node_modules/firebase/auth'
  Parsed request is a module
  using description file: /Users/Mike/Code/ionic/foo-bar/node_modules/firebase/package.json (relative path: ./auth)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /Users/Mike/Code/ionic/foo-bar/node_modules/firebase/package.json (relative path: ./auth)
    resolve as module
      looking for modules in /Users/Mike/Code/ionic/foo-bar/node_modules
        using description file: /Users/Mike/Code/ionic/foo-bar/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: /Users/Mike/Code/ionic/foo-bar/package.json (relative path: ./node_modules)
          using description file: /Users/Mike/Code/ionic/foo-bar/package.json (relative path: ./node_modules/@firebase/auth)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/auth doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/auth.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/auth.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/auth.json doesn't exist
            as directory
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/auth doesn't exist
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/auth]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/auth.ts]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/auth.js]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/auth.json]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/auth]
 @ ./node_modules/firebase/auth/index.js 17:0-25
 @ ./node_modules/angularfire2/auth/auth.module.js
 @ ./node_modules/angularfire2/auth/public_api.js
 @ ./node_modules/angularfire2/auth/index.js
 @ ./src/app/app.module.ts
 @ ./src/app/main.ts,./node_modules/firebase/database/index.js
Module not found: Error: Can't resolve '@firebase/database' in '/Users/Mike/Code/ionic/foo-bar/node_modules/firebase/database'
resolve '@firebase/database' in '/Users/Mike/Code/ionic/foo-bar/node_modules/firebase/database'
  Parsed request is a module
  using description file: /Users/Mike/Code/ionic/foo-bar/node_modules/firebase/package.json (relative path: ./database)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /Users/Mike/Code/ionic/foo-bar/node_modules/firebase/package.json (relative path: ./database)
    resolve as module
      looking for modules in /Users/Mike/Code/ionic/foo-bar/node_modules
        using description file: /Users/Mike/Code/ionic/foo-bar/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: /Users/Mike/Code/ionic/foo-bar/package.json (relative path: ./node_modules)
          using description file: /Users/Mike/Code/ionic/foo-bar/package.json (relative path: ./node_modules/@firebase/database)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/database doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/database.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/database.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/database.json doesn't exist
            as directory
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/database doesn't exist
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/database]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/database.ts]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/database.js]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/database.json]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/database]
 @ ./node_modules/firebase/database/index.js 17:17-46
 @ ./node_modules/firebase/index.js
 @ ./src/providers/imgHandler.ts
 @ ./src/app/app.module.ts
 @ ./src/app/main.ts,./node_modules/firebase/firestore/index.js
Module not found: Error: Can't resolve '@firebase/firestore' in '/Users/Mike/Code/ionic/foo-bar/node_modules/firebase/firestore'
resolve '@firebase/firestore' in '/Users/Mike/Code/ionic/foo-bar/node_modules/firebase/firestore'
  Parsed request is a module
  using description file: /Users/Mike/Code/ionic/foo-bar/node_modules/firebase/package.json (relative path: ./firestore)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /Users/Mike/Code/ionic/foo-bar/node_modules/firebase/package.json (relative path: ./firestore)
    resolve as module
      looking for modules in /Users/Mike/Code/ionic/foo-bar/node_modules
        using description file: /Users/Mike/Code/ionic/foo-bar/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: /Users/Mike/Code/ionic/foo-bar/package.json (relative path: ./node_modules)
          using description file: /Users/Mike/Code/ionic/foo-bar/package.json (relative path: ./node_modules/@firebase/firestore)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/firestore doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/firestore.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/firestore.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/firestore.json doesn't exist
            as directory
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/firestore doesn't exist
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/firestore]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/firestore.ts]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/firestore.js]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/firestore.json]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/firestore]
 @ ./node_modules/firebase/firestore/index.js 17:0-30
 @ ./node_modules/angularfire2/firestore/firestore.js
 @ ./node_modules/angularfire2/firestore/public_api.js
 @ ./node_modules/angularfire2/firestore/index.js
 @ ./src/app/app.module.ts
 @ ./src/app/main.ts,./node_modules/firebase/messaging/index.js
Module not found: Error: Can't resolve '@firebase/messaging' in '/Users/Mike/Code/ionic/foo-bar/node_modules/firebase/messaging'
resolve '@firebase/messaging' in '/Users/Mike/Code/ionic/foo-bar/node_modules/firebase/messaging'
  Parsed request is a module
  using description file: /Users/Mike/Code/ionic/foo-bar/node_modules/firebase/package.json (relative path: ./messaging)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /Users/Mike/Code/ionic/foo-bar/node_modules/firebase/package.json (relative path: ./messaging)
    resolve as module
      looking for modules in /Users/Mike/Code/ionic/foo-bar/node_modules
        using description file: /Users/Mike/Code/ionic/foo-bar/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: /Users/Mike/Code/ionic/foo-bar/package.json (relative path: ./node_modules)
          using description file: /Users/Mike/Code/ionic/foo-bar/package.json (relative path: ./node_modules/@firebase/messaging)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/messaging doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/messaging.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/messaging.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/messaging.json doesn't exist
            as directory
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/messaging doesn't exist
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/messaging]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/messaging.ts]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/messaging.js]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/messaging.json]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/messaging]
 @ ./node_modules/firebase/messaging/index.js 17:0-30
 @ ./node_modules/firebase/index.js
 @ ./src/providers/imgHandler.ts
 @ ./src/app/app.module.ts
 @ ./src/app/main.ts,./node_modules/firebase/storage/index.js
Module not found: Error: Can't resolve '@firebase/storage' in '/Users/Mike/Code/ionic/foo-bar/node_modules/firebase/storage'
resolve '@firebase/storage' in '/Users/Mike/Code/ionic/foo-bar/node_modules/firebase/storage'
  Parsed request is a module
  using description file: /Users/Mike/Code/ionic/foo-bar/node_modules/firebase/package.json (relative path: ./storage)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /Users/Mike/Code/ionic/foo-bar/node_modules/firebase/package.json (relative path: ./storage)
    resolve as module
      looking for modules in /Users/Mike/Code/ionic/foo-bar/node_modules
        using description file: /Users/Mike/Code/ionic/foo-bar/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: /Users/Mike/Code/ionic/foo-bar/package.json (relative path: ./node_modules)
          using description file: /Users/Mike/Code/ionic/foo-bar/package.json (relative path: ./node_modules/@firebase/storage)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/storage doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/storage.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/storage.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/storage.json doesn't exist
            as directory
              /Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/storage doesn't exist
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/storage]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/storage.ts]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/storage.js]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/storage.json]
[/Users/Mike/Code/ionic/foo-bar/node_modules/@firebase/storage]
 @ ./node_modules/firebase/storage/index.js 17:0-28
 @ ./node_modules/firebase/index.js
 @ ./src/providers/imgHandler.ts
 @ ./src/app/app.module.ts
 @ ./src/app/main.ts
    at new BuildError (/Users/Mike/Code/ionic/foo-bar/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
    at callback (/Users/Mike/Code/ionic/foo-bar/node_modules/@ionic/app-scripts/dist/webpack.js:121:28)
    at emitRecords.err (/Users/Mike/Code/ionic/foo-bar/node_modules/webpack/lib/Compiler.js:269:13)
    at Compiler.emitRecords (/Users/Mike/Code/ionic/foo-bar/node_modules/webpack/lib/Compiler.js:375:38)
    at emitAssets.err (/Users/Mike/Code/ionic/foo-bar/node_modules/webpack/lib/Compiler.js:262:10)
    at applyPluginsAsyncSeries1.err (/Users/Mike/Code/ionic/foo-bar/node_modules/webpack/lib/Compiler.js:368:12)
    at next (/Users/Mike/Code/ionic/foo-bar/node_modules/tapable/lib/Tapable.js:218:11)
    at Compiler.compiler.plugin (/Users/Mike/Code/ionic/foo-bar/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
    at Compiler.applyPluginsAsyncSeries1 (/Users/Mike/Code/ionic/foo-bar/node_modules/tapable/lib/Tapable.js:222:13)
    at Compiler.afterEmit (/Users/Mike/Code/ionic/foo-bar/node_modules/webpack/lib/Compiler.js:365:9)

的package.json:

{
  "name": "foo-bar",
  "version": "2.0.1",
  "author": "Optimatec",
  "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/common": "4.4.4",
    "@angular/compiler": "4.4.4",
    "@angular/compiler-cli": "4.4.4",
    "@angular/core": "4.4.4",
    "@angular/forms": "4.4.4",
    "@angular/http": "4.4.4",
    "@angular/platform-browser": "4.4.4",
    "@angular/platform-browser-dynamic": "4.4.4",
    "@ionic-native/app-version": "^4.4.2",
    "@ionic-native/call-number": "4.3.0",
    "@ionic-native/camera": "4.3.0",
    "@ionic-native/clipboard": "^4.4.2",
    "@ionic-native/core": "4.3.0",
    "@ionic-native/diagnostic": "4.3.0",
    "@ionic-native/facebook": "4.3.0",
    "@ionic-native/file": "4.3.0",
    "@ionic-native/file-chooser": "4.3.0",
    "@ionic-native/file-path": "4.3.0",
    "@ionic-native/file-transfer": "^4.4.2",
    "@ionic-native/firebase": "4.3.0",
    "@ionic-native/geolocation": "4.3.0",
    "@ionic-native/google-maps": "4.3.0",
    "@ionic-native/google-plus": "4.3.0",
    "@ionic-native/in-app-browser": "4.3.0",
    "@ionic-native/launch-navigator": "4.3.0",
    "@ionic-native/onesignal": "4.3.0",
    "@ionic-native/social-sharing": "4.3.0",
    "@ionic-native/splash-screen": "4.3.0",
    "@ionic-native/status-bar": "4.3.0",
    "@ionic-native/vibration": "4.3.0",
    "@ionic/storage": "2.1.3",
    "@ngx-translate/core": "8.0.0",
    "@ngx-translate/http-loader": "2.0.0",
    "angular2-moment": "^1.7.0",
    "angularfire2": "^5.0.0-rc.0",
    "branch-cordova-sdk": "^2.6.18",
    "call-number": "^1.0.1",
    "com.googlemaps.ios": "https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk",
    "cordova-android": "^6.3.0",
    "cordova-clipboard": "^1.1.1",
    "cordova-plugin-actionsheet": "^2.3.3",
    "cordova-plugin-app-version": "^0.1.9",
    "cordova-plugin-camera": "^2.4.1",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-device": "^1.1.7",
    "cordova-plugin-dialogs": "^1.3.4",
    "cordova-plugin-facebook4": "^1.9.1",
    "cordova-plugin-file": "^5.0.0",
    "cordova-plugin-file-transfer": "^1.7.0",
    "cordova-plugin-filechooser": "^1.0.1",
    "cordova-plugin-filepath": "^1.1.0",
    "cordova-plugin-firebase": "^0.1.24",
    "cordova-plugin-geolocation": "^2.4.3",
    "cordova-plugin-googlemaps": "^2.1.1",
    "cordova-plugin-googlemaps-sdk": "git+https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk.git",
    "cordova-plugin-googleplus": "^5.1.1",
    "cordova-plugin-inappbrowser": "^1.7.2",
    "cordova-plugin-splashscreen": "^4.1.0",
    "cordova-plugin-statusbar": "^2.3.0",
    "cordova-plugin-vibration": "^2.1.6",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-x-socialsharing": "^5.2.1",
    "cordova.plugins.diagnostic": "^3.7.2",
    "es6-promise-plugin": "^4.1.0",
    "firebase": "^4.5.0",
    "ionic-angular": "^3.7.1",
    "ionic-img-viewer": "2.7.0",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionic2-rating": "^1.2.2",
    "ionicons": "3.0.0",
    "moment": "^2.19.2",
    "onesignal-cordova-plugin": "^2.2.4",
    "promise-polyfill": "6.1.0",
    "rxjs": "5.4.3",
    "sw-toolbox": "3.6.0",
    "uk.co.workingedge.phonegap.plugin.launchnavigator": "^4.1.0",
    "zone.js": "0.8.18"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.1.2",
    "typescript": "2.4.0"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-x-socialsharing": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-whitelist": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-firebase": {},
      "call-number": {},
      "mx.ferreyra.callnumber": {},
      "cordova-plugin-vibration": {},
      "cordova-plugin-facebook4": {
        "APP_ID": "15196419",
        "APP_NAME": "FooBar"
      },
      "cordova-plugin-camera": {},
      "onesignal-cordova-plugin": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-googleplus": {
        "REVERSED_CLIENT_ID": "com.googleusercontent.app"
      },
      "cordova.plugins.diagnostic": {},
      "cordova-plugin-filechooser": {},
      "cordova-plugin-filepath": {},
      "branch-cordova-sdk": {},
      "uk.co.workingedge.phonegap.plugin.launchnavigator": {},
      "cordova-clipboard": {},
      "cordova-plugin-app-version": {},
      "cordova-plugin-file-transfer": {},
      "cordova-plugin-googlemaps": {
        "API_KEY_FOR_ANDROID": "AIzaSyBYJVEVRyo7Az",
        "API_KEY_FOR_IOS": "AIzaSyCqe2DU",
        "LOCATION_WHEN_IN_USE_DESCRIPTION": "Show your location on the map",
        "LOCATION_ALWAYS_USAGE_DESCRIPTION": "Trace your location on the map"
      },
      "cordova-plugin-geolocation": {
        "GEOLOCATION_USAGE_DESCRIPTION": "To display to you the most close places based on your location"
      },
      "com.googlemaps.ios": {},
      "cordova-plugin-file": {}
    },
    "platforms": [
      "android"
    ]
  }
}

2 个答案:

答案 0 :(得分:1)

很抱歉回复已解决的问题,但我认为对于使用@ angular / 4. *而没有降级依赖关系的人来说,知道一个解决方案可能会很好,这是@ angular / *和ionic-angular问题,你应该升级那些依赖。

解决这个问题:

npm install --save @angular/common@4.4.3 
npm install --save @angular/compiler@4.4.3 
npm install --save @angular/compiler-cli@4.4.3 
npm install --save @angular/core@4.4.3 
npm install --save @angular/forms@4.4.3 
npm install --save @angular/http@4.4.3 
npm install --save @angular/platform-browser@4.4.3 
npm install --save @angular/platform-browser-dynamic@4.4.3 
npm install --save ionic-angular@3.7.1

答案 1 :(得分:0)

关于firebase版本的全部内容不应该是4.7.0所以我降级

该咒语是:

npm install firebase@4.6.2 --save