【问题标题】:Ionic build error Cannot find module './scheduler/Action'离子构建错误找不到模块'./scheduler/Action'
【发布时间】:2018-10-19 20:13:39
【问题描述】:

所以我一直在开发一个离子应用程序,当我构建它时,我得到了 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 依赖项,但我根本不知道从哪里开始,也不想再弄乱我的应用程序。

【问题讨论】:

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


    【解决方案1】:

    在解决解决方案这一天之后,我正确地重新安装了 angular 和 cli 到最新版本

    npm install -g @angular/cli@latest
    

    然后也执行了这个命令

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

    这让之前的问题消失了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-07-20
      • 2018-05-25
      • 2021-11-21
      • 2018-03-19
      • 2018-02-27
      • 2018-07-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多