这段时间发现做移动端的开发调试是一大难题,网上逛了逛发现有一些工具可用,如chrome的远程调试,实际测试过程中我始终调试不成功,听说被墙后是不行的,所以最终找了如下的方法。

因为基于nodeJS环境,之前又没有搞过它,所以做一下备忘。

Node环境配置

Node.js的安装很方便,打开下载页https://nodejs.org/#download,直接install按钮提示下载,完成后一路next就可以了,安装完成后首先要验证一下看是否安装成功:

1.运行中输入cmd

2.在命令提示符下输入 node -v

  结果如下:

C:\Users\Administrator>node -v
v0.12.2

  说明 node安装成功

3.在命令提示符下输入 npm -v

  结果如下: 

C:\Users\Administrator>npm -v
2.7.4

  说明自带了npm

4.测试npm安装功能,输入 C:\Users\Administrator>npm install express -g,等待下载安装express

  注意:安装完node后需要把安装目录的安全权限设置成可写可修改,不然用npm安装其它包有可能不成功,因为它会在node目录下会建立两个目录 "node_cache"、“node_global",当然你也可以自己手工建立这两个目录并设置相应的权限。

  返回结果:

C:\Users\Administrator>npm install express -g
express@4.12.3 C:\Program Files\nodejs\node_global\node_modules\express
├── merge-descriptors@1.0.0
├── utils-merge@1.0.0
├── cookie-signature@1.0.6
├── methods@1.1.1
├── fresh@0.2.4
├── escape-html@1.0.1
├── range-parser@1.0.2
├── cookie@0.1.2
├── finalhandler@0.3.4
├── content-type@1.0.1
├── parseurl@1.3.0
├── vary@1.0.0
├── serve-static@1.9.2
├── content-disposition@0.5.0
├── path-to-regexp@0.1.3
├── depd@1.0.1
├── qs@2.4.1
├── on-finished@2.2.1 (ee-first@1.1.0)
├── debug@2.1.3 (ms@0.7.0)
├── type-is@1.6.1 (media-typer@0.3.0, mime-types@2.0.10)
├── accepts@1.2.5 (negotiator@0.5.1, mime-types@2.0.10)
├── send@0.12.2 (ms@0.7.0, destroy@1.0.3, mime@1.3.4)
├── proxy-addr@1.0.7 (forwarded@0.1.0, ipaddr.js@0.1.9)
└── etag@1.5.1 (crc@3.2.1)

测试刚才安装的express

1.输入node进入node

2.输入 require('express'),返回如下结果说明安装成功

注意:运行上面的命令之前需要

进入环境变量对话框,在系统变量下新建"NODE_PATH",输入”C:\Program Files\nodejs\node_global\node_modules“,这一步相当关键。
上面的用户变量都要跟着改变一下(用户变量"PATH"修改为“C:\Program Files\nodejs\node_global\”),要不使用module的时候会导致输入命令出现“xxx不是内部或外部命令,也不是可运行的程序或批处理文件”这个错误。
 
{ [Function: createApplication]
application:
{ init: [Function],
defaultConfiguration: [Function],
lazyrouter: [Function],
handle: [Function],
use: [Function: use],
route: [Function],
engine: [Function],
param: [Function],
set: [Function],
path: [Function],
enabled: [Function],
disabled: [Function],
enable: [Function],
disable: [Function],
checkout: [Function],
connect: [Function],
copy: [Function],
delete: [Function],
get: [Function],
head: [Function],
lock: [Function],
'm-search': [Function],
merge: [Function],
mkactivity: [Function],
mkcol: [Function],
move: [Function],
notify: [Function],
options: [Function],
patch: [Function],
post: [Function],
propfind: [Function],
proppatch: [Function],
purge: [Function],
put: [Function],
report: [Function],
search: [Function],
subscribe: [Function],
trace: [Function],
unlock: [Function],
unsubscribe: [Function],
all: [Function],
del: [Function],
render: [Function],
listen: [Function] },
request:
{ header: [Function],
get: [Function],
accepts: [Function],
acceptsEncodings: [Function],
acceptsEncoding: [Function],
acceptsCharsets: [Function],
acceptsCharset: [Function],
acceptsLanguages: [Function],
acceptsLanguage: [Function],
range: [Function],
param: [Function: param],
is: [Function],
protocol: [Getter],
secure: [Getter],
ip: [Getter],
ips: [Getter],
subdomains: [Getter],
path: [Getter],
hostname: [Getter],
host: [Getter],
fresh: [Getter],
stale: [Getter],
xhr: [Getter] },
response:
{ status: [Function],
links: [Function],
send: [Function: send],
json: [Function: json],
jsonp: [Function: jsonp],
sendStatus: [Function: sendStatus],
sendFile: [Function: sendFile],
sendfile: [Function],
download: [Function: download],
type: [Function],
contentType: [Function],
format: [Function],
attachment: [Function: attachment],
append: [Function: append],
header: [Function: header],
set: [Function: header],
get: [Function],
clearCookie: [Function],
cookie: [Function],
location: [Function],
redirect: [Function: redirect],
vary: [Function],
render: [Function] },
Route: [Function: Route],
Router:
{ [Function]
param: [Function: param],
handle: [Function],
process_params: [Function],
use: [Function: use],
route: [Function],
checkout: [Function],
connect: [Function],
copy: [Function],
delete: [Function],
get: [Function],
head: [Function],
lock: [Function],
'm-search': [Function],
merge: [Function],
mkactivity: [Function],
mkcol: [Function],
move: [Function],
notify: [Function],
options: [Function],
patch: [Function],
post: [Function],
propfind: [Function],
proppatch: [Function],
purge: [Function],
put: [Function],
report: [Function],
search: [Function],
subscribe: [Function],
trace: [Function],
unlock: [Function],
unsubscribe: [Function],
all: [Function] },
query: [Function: query],
static:
{ [Function: serveStatic]
mime:
{ types: [Object],
extensions: [Object],
default_type: 'application/octet-stream',
Mime: [Function: Mime],
charsets: [Object] } } }
>

  

至此node环境安装配置完成

weinre安装配置

1.根据安装express的方式,在命令提示符下输入:

C:\Users\Administrator>npm install weinre -g

返回:

C:\Program Files\nodejs\node_global\weinre -> C:\Program Files\nodejs\node_globa
l\node_modules\weinre\weinre
weinre@2.0.0-pre-I0Z7U9OV C:\Program Files\nodejs\node_global\node_modules\weinr
e
├── underscore@1.7.0
├── nopt@3.0.1 (abbrev@1.0.5)
└── express@2.5.11 (mime@1.2.4, qs@0.4.2, mkdirp@0.3.0, connect@1.9.2) C:\Users\Administrator>

安装成功

2.运行weinre

C:\Users\Administrator>weinre --boundHost -all-
2015-04-23T02:29:10.030Z weinre: starting server at http://localhost:8080

3.用浏览器验证

在浏览器地址栏输入:http://localhost:8080/,会看到一些weinre的一些信息,说明运行成功

4.配置调试信息,在要调试的页面中引用:http://localhost:8080/target/target-script-min.js#anonymous,如下所示

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1 maximum-scale=1, user-scalable=no">
<title>帮助</title>
<script src="http://10.11.48.103:8080/target/target-script-min.js#anonymous"></script> </head>

  记得要把localhost换成运行weinre的主机IP,不然访问不到的

5.在weinre主页点击“http://localhost:8080/client/#anonymous”进入调试工具界面了

剩下的就像用firebug一样方便了

最后说一句,要保持运行weinre的命令提示符窗口一直处于运行状态,不然weinre的服务就访问不了了,也就做不了调试了

配置移动前端开发调试环境(nodejs+npm+weiner的安装和配置使用)的更多相关文章

  1. PHP开发调试环境配置

    ——基于wamp和Eclipse for PHP Developers 引言 为了搭建PHP开发调试环境,我曾经在网上查阅了无数的资料,但没有一种真正能够行的通的.因为PHP开发环境需要很多种软件相互 ...

  2. 玩转VSCode-完整构建VSCode开发调试环境

    随着VSCode的不断完善和强大,是时候将部分开发迁移到VS Code中了. 目前使用VS2019开发.NET Core应用,一直有一个想法,在VS Code中复刻VS的开发环境,同时迁移到VS Co ...

  3. 配置Windows 2008 R2 64位 Odoo 8.0 源码PyCharm开发调试环境

    安装过程中,需要互联网连接下载python依赖库: 1.安装: Windows Server 2008 R2 x64标准版 2.安装: Python 2.7.10 amd64 到C:\Python27 ...

  4. 配置Windows 2008 R2 64位 Odoo 8.0/9.0 源码开发调试环境

    安装过程中,需要互联网连接下载python依赖库: 1.安装: Windows Server 2008 R2 x64标准版 2.安装: Python 2.7.10 amd64 到C:\Python27 ...

  5. (转 留存)Windows环境下的NodeJS+NPM+GIT+Bower安装配置步骤

    Windows环境下的NodeJS+NPM+GIT+Bower安装配置步骤 标签: NodeJSnpmbower 2015-07-17 16:38 3016人阅读 评论(0) 收藏 举报  分类: G ...

  6. PHP开发调试环境配置(基于wampserver+Eclipse for PHP Developers )

    1 软件准 WampServer 下载地址:http://www.wampserver.com/en/#download-wrapper    我下的是 里面包含了搭建PHP必须的4个软件:   1. ...

  7. golang在Windows下Sublime Text开发调试环境的配置

    一.前言 近期本人有工作调动,进入了一个全新的领域[golang]服务端开发.在此写下本文,希望给那些没接触过golang开发调试环境及还在犹豫选择那家golang IDE而纠结的朋友们一点点帮助,如 ...

  8. 在Mac系统上配置Android真机调试环境

    在Mac系统上配置Android真机调试环境 mac上配置安卓环境还说挺方便的,真机调试也比win上要好一些.win上被各种软件强行安装了xxx助手. 在mac上就了一个干净的感觉. 下载Androi ...

  9. windows下用eclipse+goclipse插件+gdb搭建go语言开发调试环境

    windows下用eclipse+goclipse插件+gdb搭建go语言开发调试环境   http://rongmayisheng.com/post/windows%E4%B8%8B%E7%94%A ...

随机推荐

  1. Android WebView的Js对象注入漏洞解决方案

    http://blog.csdn.net/leehong2005/article/details/11808557/ webview调用以下文件,就可以打印sdcard 文件名 <!DOCTYP ...

  2. Linux查找含有某字符串的所有文件

    转自:http://151wqooo.blog.51cto.com/2610898/1162118 如果你想在当前目录下 查找"hello,world!"字符串,可以这样: gre ...

  3. Django 之 分表

    app名称为'core',基本的models.py文件内容如下: class Province(models.Model): name = models.CharField(u'省份名称',max_l ...

  4. CentOS7:安装Zabbix

    参考:CentOS 7 yum安装Zabbix 1. 安装Zabbix Server EPEL源里面有Zabbix的安装包,所以需要先安装EPEL. Zabbix源也可以从这里获得:http://re ...

  5. 【原】mysql慢日志分析

    pt-query-digest slowquery.log --since "2016-01-23 10:50:00"

  6. 新做的一个基于OPENGL的gui库

    #include <BGE/All> ,text);     button->setName(name);     button->setSize(Vector2f(,)); ...

  7. map,hash_map, hash_table, 红黑树 的原理和使用

    在刷算法题的时候总是碰到好多题,号称可以用hash table来解题.然后就蒙圈了. 1.首先,map和hash_map的区别和使用: (1)map底层用红黑树实现,hash_map底层用hash_t ...

  8. ubuntu-利用pdnsd-TCP方式获取IP-拒绝DNS污染

    那,自从国内技术出现了DNS污染问题呢,时常导致很多国外网站访问不正常,所以通过参考一些博客所属避免DNS污染的方法,决定搭建一个Ubuntu JeOS下的DNS缓存服务器,该服务器利用TCP方式获取 ...

  9. Xcode7打包,iOS9真机闪退,如何解决?

    问:有些项目用xcode7打开运行,打包安装到iOS9设备上程序会闪退. 如果用xcode7以下编译,然后打包到iOS9的设备上就是正常的.这是为什么,关键是,怎么解决? 答:iOS9发布之后,有些a ...

  10. JS数组键值,数组合并,

    eg: var arr = [] arr.test = '测试'; arr.push(1); arr.push(2); arr.obj = '对象'; console.log(arr);// [ 1, ...