weinre主页
http://people.apache.org/~pmuellr/weinre/docs/latest/Home.html
weinre调试服务器基于node.js实现,因此先安装node 运行环境。1下载并安装node管理工具
http://nodejs.org/download/
2。windows上使用 Node.js Command prompt安装
npm install weinre
weinre安装成功
3运行weinre
打开命令行输入
node.exe node_modules\weinre\weinre --boundHost -all-
这个时候在浏览器输入
http://localhost:8080/
就可以看到如图效果
说明服务正常,
在命令行中输入
node.exe node_modules\weinre\weinre --boundHost 192.168.137.1
可以指定当前机器的IP,然后可以供移动设备访问,
这个时候就可以在移动设备上测试下是否能访问weinre 的服务器,如果不能访问,要看下防火墙的配置。
在命令行输入
node.exe node_modules\weinre\weinre --help
可以返回相关的使用命令
比如--httpPort 修改运行weinre 服务的端口
输入以下命令可以修改端口号为8089
node.exe node_modules\weinre\weinre --httpPort 8089
打开
http://localhost:8089/
则可以看到如下页面
点击
http://localhost:8089/client/#anonymous |
进入到userinterface(用户界面)
可以在要调试的页面中加入此行代码。
<script src="http://182.168.137.1:8089/target/target-script-min.js#anonymous"></script>
然后访问欲调试页面,再打开
http://192.168.137.1:8089/client/#anonymous
就可以实时进行调试了。
如果懒得自己搭建环境,也可以使用phonegap的服务
打开网站http://debug.phonegap.com/
<script src="http://debug.phonegap.com/target/target-script-min.js#anonymous"></script>
node.exe node_modules\weinre\weinre --boundHost 192.168.1.1