错误:在“导入”中找到多个IonicModule.forRoot调用。只允许一个

时间:2019-01-17 01:22:41

标签: ionic-framework ionic3

我刚刚克隆了一个Github存储库并安装了它的软件包。但是当我运行ionic serve时遇到了这个错误。我检查了npm: 3.5.2nodejs: v8.10.0。我的桌面操作系统是Ubuntu 18.04LTS

到目前为止,我已经尝试删除重新安装每个软件包并重新安装ionic客户端的操作。另外,我检查了app.module.ts,从ionic-angular的导入是:

import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';

我想知道错误的forRoot到底是什么意思,怎么解决这个问题?

[09:10:20]  ionic-app-script task: "serve"
[app-scripts] [09:10:20]  Error: Found multiple IonicModule.forRoot calls in"imports". Only one is allowed
[app-scripts] Error: Found multiple IonicModule.forRoot calls in "imports". Only one is allowed
[app-scripts]     at new BuildError (/home/...../node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
[app-scripts]     at /home/..../node_modules/@ionic/app-scripts/dist/deep-linking.js:57:21
[app-scripts]     at <anonymous>

[ERROR] ionic-app-scripts has unexpectedly closed (exit code 1).

        The Ionic CLI will exit. Please check any output above for error details.

1 个答案:

答案 0 :(得分:0)

IonicModule.forRoot(appRoot, config, deepLinkConfig)为您的IonicModule设置了根应用程序组件。

如果进行了设置,则可能需要删除bootstrap: [AppComponent]

或设置IonicModule.forRoot(),不带参数。

看看IonicModule