我最近一直在尝试离子实验室查看尝试。从文档中,它就像命令一样简单 ionic serve --lab
.但这只显示正常的ionic serve
视图,而不是安卓和苹果手机视图。我没有看到任何错误。
$ ionic serve -l
> ionic-hello-world@ ionic:serve /home/raj/ionic/bookemon
> ionic-app-scripts serve "--v2" "--lab" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
[12:10:35] ionic-app-scripts 1.0.0
[12:10:35] watch started ...
[12:10:35] build dev started ...
[12:10:35] clean started ...
[12:10:35] clean finished in 6 ms
[12:10:35] copy started ...
[12:10:35] transpile started ...
[12:10:39] transpile finished in 3.58 s
[12:10:39] webpack started ...
[12:10:39] copy finished in 3.74 s
[12:10:46] webpack finished in 6.89 s
[12:10:46] sass started ...
[12:10:47] sass finished in 719 ms
[12:10:47] build dev finished in 11.23 s
[12:10:47] watch ready in 11.31 s
[12:10:47] dev server running: http://localhost:8100/
这是我的离子信息
Your system information:
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.6
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v7.2.1
Xcode version: Not installed
不知道这里发生了什么。我尝试重新安装ionic
并npm_modules
但它不起作用。有什么帮助吗?提前谢谢。
你确定你打开的是http://localhost:8101/ionic-lab
而不仅仅是http://localhost:8101
吗?
- 运行
ionic serve --lab
或ionic serve -l
- 转到
http://localhost:8101/ionic-lab
注意
-
localhost:8101
加载普通视图和 -
localhost:8101/ionic-lab
将带有选项的视图加载到各种平台
"scripts": {
"build": "ionic-app-scripts build",
"watch": "ionic-app-scripts watch",
"serve:before": "watch",
"emulate:before": "watch",
"deploy:before": "build",
"build:before": "build",
"run:before": "watch"
}
在package.json
将脚本更改为上述并运行ionic serve -l
我认为ionic serve -l
不起作用,因为 Ionic 2 使用ionic-app-scripts.
同时,他们使用离子视图应用程序进行实时测试。
查看此处 https://play.google.com/store/apps/details?id=com.ionic.viewapp&hl=en