0

当我运行 ionic serve 时,它​​会构建应用程序但服务器没有运行。这是线索:

    Starting app-scripts server: --address 0.0.0.0 --port 8100 --livereload-port 35729 
--dev-logger-port 53703 --nobrowser - Ctrl+C to cancel
[17:55:35]  watch started ... 
[17:55:35]  build dev started ... 
[17:55:36]  clean started ... 
[17:55:36]  clean finished in 2 ms 
[17:55:36]  copy started ... 
[17:55:36]  deeplinks started ... 
[17:55:37]  deeplinks finished in 589 ms 
[17:55:37]  transpile started ... 
[17:55:44]  transpile finished in 7.38 s 
[17:55:44]  preprocess started ... 
[17:55:44]  copy finished in 8.56 s 
[17:55:44]  preprocess finished in 206 ms 
[17:55:44]  webpack started ... 

在 webpack 启动之后,cli 就退出了,我看到了正常的终端提示。

尝试 npm run ionic:serve 命令会导致此错误:

TypeError: Cannot read property 'substr' of undefined

到目前为止,我已经重新安装了 ionic,结果相同。有点不知道怎么处理这个...

4

1 回答 1

0

事实证明,这是在一个 ts 文件中创建多个组件类时引起的。将这些类分别拆分到自己的文件中可以解决问题。

与此相关https://github.com/ionic-team/ionic-app-scripts/issues/796

于 2017-11-15T08:40:42.970 回答