离子服务显示空白页

时间:2019-01-02 09:09:23

标签: angular ionic-framework webpack

Screenshot 我的猜测是某些软件包之间不兼容。
到目前为止,这是我尝试过的。

  1. 更新离子
    npm install -g ionic@latest

  2. 安装最新的ionic-app-scripts
    npm install @ionic/app-scripts@latest --save-dev

  3. 已删除node_modules文件夹并重新运行npm install

  4. 清除的浏览器缓存也尝试在其他浏览器[Chrome,Safari]中打开。

  5. Ran ionic repair

  6. 运行带有npm cache clear标志且没有该标志的--force

这是我的package.json

{
  "name": "FireSide",
  "version": "0.1.4",
  "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",
    "test": "ng test"
  },
  "config": {
    "ionic_webpack": "./config/webpack.config.js"
  },
  "dependencies": {
    "@angular/cli": "^7.1.4",
    "@angular/common": "^5.2.11",
    "@angular/compiler": "^5.0.1",
    "@angular/compiler-cli": "^5.0.1",
    "@angular/core": "^5.0.1",
    "@angular/forms": "^5.0.1",
    "@angular/http": "^5.0.1",
    "@angular/platform-browser": "^5.0.1",
    "@angular/platform-browser-dynamic": "^5.0.1",
    "@ionic-native/android-permissions": "^4.18.0",
    "@ionic-native/barcode-scanner": "^4.18.0",
    "@ionic-native/call-number": "^4.18.0",
    "@ionic-native/camera": "^4.18.0",
    "@ionic-native/core": "^4.18.0",
    "@ionic-native/device": "^4.18.0",
    "@ionic-native/file": "^4.18.0",
    "@ionic-native/google-analytics": "^4.18.0",
    "@ionic-native/network": "^4.18.0",
    "@ionic-native/open-native-settings": "^4.18.0",
    "@ionic-native/splash-screen": "^4.18.0",
    "@ionic-native/sqlite": "^4.18.0",
    "@ionic-native/status-bar": "^4.18.0",
    "@ionic/storage": "^2.2.0",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "angular2-moment": "^1.9.0",
    "awesome-phonenumber": "^2.3.1",
    "call-number": "^1.0.1",
    "clean": "^4.0.2",
    "com.wezka.nativecamera": "~0.1.2",
    "cordova-android": "^5.0.1",
    "cordova-browser": "5.0.4",
    "cordova-open-native-settings": "^1.5.2",
    "cordova-plugin-android-permissions": "^1.0.0",
    "cordova-plugin-camera": "^4.0.3",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-file": "^6.0.1",
    "cordova-plugin-google-analytics": "^1.8.6",
    "cordova-plugin-network-information": "^2.0.1",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-sqlite-storage": "^2.6.0",
    "ionic-angular": "^3.9.2",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionic-select-searchable": "^2.10.0",
    "ionic2-material-icons": "^1.0.3",
    "ionicons": "4.5.1",
    "karma-coverage-istanbul-reporter": "^2.0.4",
    "karma-jasmine-html-reporter": "^1.4.0",
    "mx.ferreyra.callnumber": "0.0.2",
    "phonegap-plugin-barcodescanner": "^8.0.1",
    "sw-toolbox": "3.6.0",
    "timezone": "^1.0.20",
    "tslib": "^1.9.3",
    "webpack": "^4.28.0",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.11.0",
    "@angular/animations": "^5.0.1",
    "@ionic-native-mocks/android-permissions": "^2.0.12",
    "@ionic-native-mocks/call-number": "^2.0.12",
    "@ionic-native-mocks/camera": "^2.0.12",
    "@ionic-native-mocks/file": "^2.0.12",
    "@ionic-native-mocks/google-analytics": "^2.0.12",
    "@ionic-native-mocks/open-native-settings": "^2.0.12",
    "@ionic/app-scripts": "^3.2.1",
    "@types/jasmine": "2.8.6",
    "@types/node": "^10.12.18",
    "angular2-template-loader": "^0.6.2",
    "codecov": "^3.1.0",
    "css-loader": "^2.0.1",
    "file-loader": "^2.0.0",
    "html-loader": "^0.5.5",
    "ionic-mocks": "^1.3.0",
    "jasmine-core": "^3.3.0",
    "jasmine-spec-reporter": "^4.2.1",
    "karma": "^3.1.4",
    "karma-chrome-launcher": "^2.2.0",
    "karma-jasmine": "^2.0.1",
    "karma-mocha-reporter": "^2.2.5",
    "karma-remap-istanbul": "^0.6.0",
    "rxjs": "^5.5.12",
    "rxjs-compat": "^6.3.3",
    "style-loader": "^0.23.1",
    "ts-loader": "^5.3.1",
    "ts-node": "^7.0.1",
    "tslint": "^5.12.0",
    "tslint-eslint-rules": "^5.4.0",
    "typescript": "2.7.2"
  },
  "description": "FireSide",
  "cordova": {
    "plugins": {
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-whitelist": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-network-information": {},
      "cordova-open-native-settings": {},
      "cordova-sqlite-storage": {},
      "phonegap-plugin-barcodescanner": {},
      "cordova-plugin-google-analytics": {},
      "cordova-plugin-file": {},
      "cordova-plugin-android-permissions": {},
      "mx.ferreyra.callnumber": {},
      "com.wezka.nativecamera": {},
      "cordova-plugin-camera": {},
      "call-number": {}
    },
    "platforms": [
      "browser",
      "android"
    ]
  }
}

这是我的ionic info

Ionic:

   ionic (Ionic CLI)  : 4.6.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.1

Cordova:

   cordova (Cordova CLI) : 7.1.0
   Cordova Platforms     : none
   Cordova Plugins       : no whitelisted plugins (0 plugins total)

System:

   NodeJS : v8.12.0 (/usr/local/Cellar/node@8/8.12.0/bin/node)
   npm    : 6.4.1
   OS     : macOS Mojave
   Xcode  : Xcode 9.0 Build version 9A235

也在运行构建时显示此错误:

ionic-app-scripts build --target cordova --platform browser
[12:01:14]  ionic-app-scripts 3.2.1 
[12:01:14]  build dev started ... 
[12:01:14]  clean started ... 
[12:01:14]  clean finished in 1 ms 
[12:01:14]  copy started ... 
[12:01:14]  deeplinks started ... 
[12:01:14]  deeplinks finished in 367 ms 
[12:01:14]  transpile started ... 
[12:01:24]  transpile finished in 9.69 s 
[12:01:24]  preprocess started ... 
[12:01:24]  preprocess finished in less than 1 ms 
[12:01:24]  webpack started ... 
[12:01:24]  ionic-app-script task: "build" 
[12:01:24]  TypeError: Cannot read property 'compilation' of undefined 
TypeError: Cannot read property 'compilation' of undefined
    at DefinePlugin.apply (/Users/**/***/node_modules/webpack/lib/DefinePlugin.js:97:18)
    at Compiler.apply (/Users/**/***/node_modules/@ionic/app-scripts/node_modules/tapable/lib/Tapable.js:375:16)
    at webpack (/Users/**/***/node_modules/@ionic/app-scripts/node_modules/webpack/lib/webpack.js:33:19)
    at /Users/**/***/node_modules/@ionic/app-scripts/dist/webpack.js:132:24
    at new Promise (<anonymous>)
    at runWebpackFullBuild (/Users/**/***/node_modules/@ionic/app-scripts/dist/webpack.js:113:12)
    at webpackWorker (/Users/**/***/node_modules/@ionic/app-scripts/dist/webpack.js:70:19)
    at Object.webpack (/Users/**/***/node_modules/@ionic/app-scripts/dist/webpack.js:29:12)
    at bundleWorker (/Users/**/***/node_modules/@ionic/app-scripts/dist/bundle.js:13:22)
    at Object.bundle (/Users/**/***/node_modules/@ionic/app-scripts/dist/bundle.js:6:12)
[ERROR] An error occurred while running subprocess ionic-app-scripts.

        ionic-app-scripts build --target cordova --platform browser exited with exit code 1.

0 个答案:

没有答案