h5调试方法 —— weinre

weinre安装

全局安装: npm install –g weinre
局部安装: npm install weinre
启动: weinre --httpPort 8090 --boundHost -all-
如果是局部安装的话,需要在前面加上 node_modules/.bin/
相信前端的童鞋都会用npm包管理工具,对于这个工具,我就不展开了,如果没有安装npm的,自行安装。

weinew启动参数说明:
–httpPort: 设置Wninre使用的端口号,默认是8080
–boundHost: [hostname | Ip | -all-]: 默认是 ‘localhost’.
–debug [true | false] : 这个选项与–verbose类似, 会输出更多的信息。默认为false。
–readTimeout [seconds] : Server发送信息到Target/Client的超时时间, 默认为5s。
–deathTimeout [seconds] : 默认为3倍的readTimeout, 如果页面超过这个时间都没有任何响应, 那么就会断开连接。
8080端口使用情况较多,所以我选择了指定8090端口。
启动了weinre之后,我们在浏览器中输入localhost:8090.显示如下界面,表示已经启动成功。

weinre.png

点击这个地方

| debug client user interface: | [http://localhost:8090/client/#anonymous](http://localhost:8090/client/#anonymous) |
debug.png

http-server安装

npm install http-server -g
cd 到自己要调试的文件的目录下,启动http-server
操作如下:

httpserver.png

然后拿手机用任意的浏览器访问就好了,访问路径:本机地址:8090/index.html
还有一点就是手机跟电脑要处于同一个局域网哦,打完收工!

你可能感兴趣的:(h5调试方法 —— weinre)