首页 文章

当我运行命令`ionic serve --lab`时,如何修复“ReferenceError:ionic not defined”?

提问于
浏览
3

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

2 回答

  • 0

    您可以通过两种方式解决问题 .

    • 删除node_modules然后运行npm update

    • 重新安装gulp(但你应该安装全局)

    npm install -g gulp
    
  • -1

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

相关问题