【问题标题】:Ionic - Ionic Serve not working, blank page离子 - 离子服务不工作,空白页
【发布时间】:2019-03-07 15:25:10
【问题描述】:

我目前正在 Ionic 框架下开发一个应用程序。在尝试在我的应用程序的一个页面对应的.js文件中注入一个状态的函数后,我遇到了一个非常奇怪的问题。

我的 Ionic Serve 刷新并变为空白,当我尝试新的 Ionic Serve 命令时,我写下了这条消息:

[WARN] Error with .\www\lib\ionic\version.json file: FILE_NOT_FOUND, trying .\bower.json.

我已经检查了互联网,我删除了我的 node_modules 文件夹并在之后安装了 npm。警告已经消失,但 Ionic Serve 仍然给我一个空白页而不是我的 index.html。

这是我的“离子信息”输出:

$ ionic info
[WARN] Error with .\www\lib\ionic\version.json file: FILE_NOT_FOUND, trying 
.\bower.json.
[WARN] Error with .\www\lib\ionic\version.json file: FILE_NOT_FOUND, trying 
.\bower.json.

cli packages: (C:\Users\RAPH\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0
Gulp CLI              : CLI version 3.9.1 Local version 3.9.1

local packages:

Cordova Platforms : android 7.0.0
Ionic Framework   : ionic1 1.3.4

System:

Android SDK Tools : 26.1.1
Node              : v10.2.1
npm               : 5.6.0
OS                : Windows 7

Environment Variables:

ANDROID_HOME : C:\Users\RAPH\AppData\Local\Android\Sdk

Misc:

backend : pro

请帮我解决这个问题,我需要完成星期天的工作。我将非常感激,如果我能在其他方面为您提供帮助,请不要犹豫,要求回报

【问题讨论】:

    标签: angularjs cordova ionic-framework


    【解决方案1】:

    这就是你整个代码块的样子吗?

    var app = angular.module('app', ['ui.router']);
    app.config(function($stateProvider, $urlRouterProvider) {
      $urlRouterProvider.otherwise("/index");
      $stateProvider
        .state("index", {
          url: "/index",
          templateUrl: "index.html"
        })
        .state("menu", {
          url: "/menu",
          templateUrl: "menu.html"
        })
        .state("indication_patient", {
          url: "/indication_patient",
          templateUrl: "indication_patient.html"
        })
        .state("competition", {
          url: "/competition",
          templateUrl: "competition.html"
        })
        .state("patient", {
          url: "/patient",
          templateUrl: "patient.html"
        })
        .state("athlete", {
          url: "/athlete",
          templateUrl: "athlete.html"
        });
    });
    

    【讨论】:

    • 这不起作用,但你是对的,这是一个语法错误!你只需要把“;”在最后一个状态之后而不是最后。感谢您的贡献,也不要犹豫寻求任何帮助。
    • 酷。不过接受我的回答。帮助结束问题
    【解决方案2】:

    尝试下载 cors google chrome 扩展并将其安装在您的 google chrome 中,然后在 google chrome 中打开扩展时重新运行“ionic serve”命令

    这里是链接: https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en

    【讨论】:

    • 这个链接甚至不存在
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-12-28
    • 1970-01-01
    • 2018-12-08
    • 2020-03-09
    • 2018-04-27
    • 2019-01-28
    • 2019-11-20
    相关资源
    最近更新 更多