【问题标题】:Import aws-amplify in Ionic2在 Ionic2 中导入 aws-amplify
【发布时间】:2018-09-24 16:22:45
【问题描述】:

概览

我使用 Visual Studio 开发了一个 ionic 移动应用。 当我在 src/app/main.ts 中添加 import 语句时,我的应用程序无法运行并且没有呈现预期的页面。 请告诉我如何解决这个问题。

我将我的应用程序发布到了 github。 link to my github page

我的应用程序无法运行

  1. 我通过 npm 命令安装了 aws-amplify。

    $ npm install aws-amplify --save

  2. 我选择了“Ionic 2 - Tabs”模板并新建了一个项目。 Visual Stido "Ionic 2 - Tabs"

  3. 我在 src/app/main.ts 中添加了 import 语句。

    import Amplify, { Auth } from 'aws-amplify';

  4. 我的应用程序无法运行。

错误消息和屏幕截图

JavaScript 控制台在下面显示消息。

Failed to load resource: net::ERR_FILE_NOT_FOUND
main.css
Failed to load resource: net::ERR_FILE_NOT_FOUND
main.js
Failed to load resource: net::ERR_FILE_NOT_FOUND
polyfills.js

我的应用应该会呈现下面的页面。

expected page

但是它渲染了下面的页面。

unexpected page

【问题讨论】:

    标签: visual-studio cordova typescript ionic-framework aws-amplify


    【解决方案1】:

    从错误来看,它与 aws-amplify 不同。首先尝试从 aws-amplify 中删除导入如何?

    这更像是视觉工作室模板有问题。我刚刚尝试了命令行,它工作正常。

    ionic start myApp tabs
    cd myApp
    ionic serve
    

    这是一个 aws starter 模板,也许您可​​以尝试关注。

    https://github.com/ionic-team/starters/tree/master/ionic-angular/official/aws

    【讨论】:

      猜你喜欢
      • 2020-05-10
      • 2023-03-20
      • 2022-01-02
      • 2021-03-19
      • 1970-01-01
      • 2020-09-06
      • 2020-08-18
      • 1970-01-01
      • 2016-11-16
      相关资源
      最近更新 更多