【问题标题】:How to fix "ReferenceError : ionic is not defined" when I run command `ionic serve --lab`?运行命令“ionic serve --lab”时如何修复“ReferenceError:离子未定义”?
【发布时间】:2015-07-10 06:21:46
【问题描述】:

我在 Yeoman 中创建了一个 Ionic 项目。当ionic serve 命令显示多个地址时,我选择了选项 localhost。但是当我运行应用程序时,它在控制台上显示错误

   ReferenceError : ionic is not defined

这是我正在遵循的完整过程 -

   Running live reload server: http://localhost:35729
   Watching : [ 'www/**/*', '!www/lib/**/*' ]
   Running dev server: http://localhost:8100
   Ionic server commands, enter:
   restart or r to restart the client app from the root
   goto or g and a url to have the app navigate to the given url
   consolelogs or c to enable/disable console log output
   serverlogs or s to enable/disable server log output
   quit or q to shutdown the server and exit

   ionic $ c
   Console log output: enabled
   Loading: /?restart=998712
   ionic $ 0     129599   error    ReferenceError: ionic is not defined,       http://localhost:8100/?ionicplatform=ios, Line: 103
    0     129653   error    ReferenceError: ionic is not defined,   http://localhost:8100/?ionicplatform=android, Line: 103

我无法理解为什么这个错误会在控制台上闪烁。 Ionic 安装在我的系统上,我已经使用ionic 命令对其进行了测试。这是我得到的错误截图。我还检查了系统中的 ionic.config 文件,它的服务器地址已经以下列方式存在

  "ionicServeAddress": "localhost"

【问题讨论】:

  • 您的 ionic.project 文件中是否定义了 gulp 任务?

标签: cordova ionic-framework yeoman


【解决方案1】:

您已经通过两种方式解决了您的问题。

  1. 删除 node_modules 然后运行 ​​npm update
  2. 重新安装 gulp(但你应该安装全局)

    npm install -g gulp
    

【讨论】:

    【解决方案2】:

    我在管理员模式下重新创建了 yeomen 项目结构,它工作正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-20
      • 2017-12-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多