cordova - 当我运行命令 "ReferenceError : ionic is not defined"时如何修复 `ionic serve --lab`?

标签 cordova ionic-framework yeoman

我在 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"

最佳答案

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

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

    npm install -g gulp
    

关于cordova - 当我运行命令 "ReferenceError : ionic is not defined"时如何修复 `ionic serve --lab`?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31333804/

相关文章:

angularjs - 使用 Angular 的 Cordova APP 中 WWAHost 中未处理的异常

jquery-mobile - phonegap jquerymobile 问题 : lost style when dynamically generating list items

html - 使用css强制将 ionic View 标题对齐到中心

javascript - Grunt 构建 useminprepare 不起作用

AngularJS + RequireJS + Bower + Karma + Yeoman + Node

sass - 在 Yeoman 上使用 Bootstrap 的 Handlebars 模板引擎

google-maps - 使用 Phonegap 离线浏览预先知道的 map

javascript - 如何使用 jQuery Mobile 进行倒计时?

ionic-framework - 需要 Branch.io ionic 集成/全局函数定义

angular - 我可以将 async/await Promises 与可观察的 RXJS 混合使用吗?