离子生成错误找不到模块'./scheduler/Action'

时间:2018-10-19 20:13:40

标签: angular ionic-framework rxjs angular-cli angularfire2

所以我一直在开发离子应用程序,当我构建它时,我得到了 this error。这是图像的完整代码。

PS D:\MEGA\proyectos\ionic\6- gag2> ionic cordova build android
> ionic-app-scripts build --target cordova --platform android
[20:45:31]  ionic-app-scripts 3.2.0
[20:45:31]  build dev started ...
[20:45:31]  clean started ...
[20:45:31]  clean finished in 32 ms
[20:45:31]  copy started ...
[20:45:31]  deeplinks started ...
[20:45:31]  deeplinks finished in 32 ms
[20:45:31]  transpile started ...
[20:45:36]  typescript: D:/MEGA/proyectos/ionic/6- gag2/node_modules/rxjs/Scheduler.d.ts, line: 1
            Cannot find module './scheduler/Action'.


       L1:  import { Action } from './scheduler/Action';
       L2:  import { Subscription } from './Subscription';

[20:45:36]  ionic-app-script task: "build"
[20:45:36]  Error: Failed to transpile program
Error: Failed to transpile program
    at new BuildError (D:\MEGA\proyectos\ionic\6- gag2\node_modules\@ionic\app-scripts\dist\util\errors.js:16:28)
    at D:\MEGA\proyectos\ionic\6- gag2\node_modules\@ionic\app-scripts\dist\transpile.js:159:20
    at new Promise (<anonymous>)
    at transpileWorker (D:\MEGA\proyectos\ionic\6- gag2\node_modules\@ionic\app-scripts\dist\transpile.js:107:12)
    at Object.transpile (D:\MEGA\proyectos\ionic\6- gag2\node_modules\@ionic\app-scripts\dist\transpile.js:64:12)
    at D:\MEGA\proyectos\ionic\6- gag2\node_modules\@ionic\app-scripts\dist\build.js:109:82
    at <anonymous>
[ERROR] An error occurred while running subprocess ionic-app-scripts.

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

        Re-running this command with the --verbose flag may provide more information.

似乎我的node_modules中缺少调度程序/操作模块。通过执行以下操作,我搜索了一个答案并得到了一个解决方案,这是一个临时解决方案:

npm install rxjs@^6.0.0 --save

然后:

npm install --save rxjs-compat

通过执行这些命令,我​​可以构建我的应用程序。但是经过一些构建后,错误又回来了,我不得不重新执行这两个命令。

here is a log whit some warnings that i get after the comands

我认为问题出在我一天前的最新更新中。我试图更新angular,angularCLI和rxjs,但我认为我做错了。

这是我的应用程序的package.json及其相关版本

{
  "name": "gag2",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "start": "ionic-app-scripts serve",
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint"
  },
  "dependencies": {
    "@angular/animations": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "5.2.11",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/camera": "^4.16.0",
    "@ionic-native/core": "~4.15.0",
    "@ionic-native/image-picker": "^4.16.0",
    "@ionic-native/splash-screen": "~4.15.0",
    "@ionic-native/status-bar": "~4.15.0",
    "@ionic/pro": "2.0.3",
    "@ionic/storage": "2.2.0",
    "angularfire2": "^5.0.2",
    "cordova-android": "7.1.1",
    "cordova-plugin-camera": "4.0.3",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-ionic-keyboard": "^2.1.3",
    "cordova-plugin-ionic-webview": "^2.2.0",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-telerik-imagepicker": "2.2.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "firebase": "^5.5.5",
    "ionic-angular": "3.9.2",
    "ionicons": "3.0.0",
    "promise-polyfill": "^8.1.0",
    "rxjs": "^6.0.0",
    "rxjs-compat": "^6.3.3",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.2.0",
    "typescript": "~2.6.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-camera": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-telerik-imagepicker": {
        "PHOTO_LIBRARY_USAGE_DESCRIPTION": "your usage message"
      }
    },
    "platforms": [
      "android"
    ]
  }
}

我想知道如何解决模块问题。我认为我必须正确更新我的angular和rxjs或安装一些angular和rxjs依赖项,但是我根本不知道从哪里开始,也不想弄乱我的应用程序。

谢谢你,如果我做错了事,这是我的第一个问题。

1 个答案:

答案 0 :(得分:0)

经过了一整天的解决方案后,我重新将角度和cli重新安装到最新版本

npm install -g @angular/cli@latest

然后执行了该命令

npm i rxjs@6 rxjs-compat@6 promise-polyfill --save

这使问题消失了。