Ionic2 离子2-运行时错误。找不到模块“;离子本机”;

Ionic2 离子2-运行时错误。找不到模块“;离子本机”;,ionic2,Ionic2,我在执行ionic 2时收到此错误: 错误 运行时错误。找不到模块“离子本机” 堆叠 g@localhost:8100/build/polyfills.js:3:7138 localhost:8100/build/main.js:113219:16 网页包_require@localhost:8100/build/main.js:20:34 localhost:8100/build/main.js:87074:92 网页包_require@localhost:8100/build/main.js

我在执行ionic 2时收到此错误:

错误

运行时错误。找不到模块“离子本机”

堆叠

g@localhost:8100/build/polyfills.js:3:7138 localhost:8100/build/main.js:113219:16 网页包_require@localhost:8100/build/main.js:20:34 localhost:8100/build/main.js:87074:92 网页包_require@localhost:8100/build/main.js:20:34 localhost:8100/build/main.js:135215:89 网页包_require@localhost:8100/build/main.js:20:34 localhost:8100/build/main.js:66:37全局 code@localhost:8100/build/main.js:67:12

安装在下面


npm安装ionic native--保存问题可能是因为ionic软件包升级。删除节点\模块文件夹

离子封装从离子2.x改为3.x。您需要做以下更改

  • package.json
    中删除对
    ionic native
    的引用。

  • 使用以下命令安装ionic 3.x本机软件包

  • npm安装@ionic native/core--保存

    npm安装@ionic native/splash screen--保存

    npm安装@ionic native/@ionic native/状态栏--保存


    3.从
    app.module.ts
    更改离子2.x本机软件包的参考

    从'@ionic native/SplashScreen'导入{SplashScreen}

    从'@ionic native/status bar'导入{StatusBar}


  • app.module.ts的提供者数组中添加
    StatusBar
    SplashScreen

  • 更新
    app.component.ts
    StatusBar
    SplashScreen
    的导入(与步骤3相同)

  • app.component.ts的构造函数中添加以下内容

  • 状态栏:状态栏,飞溅屏幕:飞溅屏幕


    7.如果您使用的是
    http
    服务,请将其导入
    app.module.ts
    中,如下所示:

    从'@angular/http'导入{HttpModule}

    在导入数组中添加
    HttpModule


    注意:您可能需要对其他类似的本机软件包执行相同的操作。

    运行以下命令以在您的项目中安装
    Ionic native

    npm install @ionic-native --save
    

    我解决了这个错误,改变了这个:

    import { NavController } from 'ionic-angular/umd'
    
    为此:

    import { NavController } from 'ionic-angular'
    

    你能添加你的package.json吗?你是用npm install@ionic native/core--savenpm install@ionic native/core--savenpm安装的吗?你可以参考下面的URL来查看错误不再有效。希望他们停止进行破坏项目的更改,并使所有文档完全无用。上述错误已解决,但出现另一个错误:类“Subject”错误地扩展了基类“Observable”。“lift”属性的类型不兼容。?