이동 전단 개발 디 버 깅 환경 설정 (nodejs + npm + weiner 설치 및 설정 사용)

8096 단어 nodejs
그 동안 모 바 일 개발 디 버 깅 을 하 는 것 이 큰 문제 라 는 것 을 알 게 되 었 습 니 다. 인터넷 을 둘 러 보 니 chrome 의 원 격 디 버 깅 과 같은 도구 가 있 었 습 니 다. 실제 테스트 과정 에서 저 는 디 버 깅 에 성공 하지 못 했 습 니 다. 벽 에 걸 린 후에 안 된다 고 해서 다음 과 같은 방법 을 찾 았 습 니 다.
nodeJS 환경 을 기반 으로 한 것 이기 때문에 이전에 그것 을 해 본 적 이 없 기 때문에 메 모 를 해 보 세 요.
노드 환경 설정
Node. js 설치 가 편리 합 니 다. 다운로드 페이지 를 엽 니 다.https://nodejs.org/#download, 직접 설치 단 추 를 누 르 면 다운 로드 를 알려 줍 니 다. 완료 후 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

설명
4. npm 설치 기능 테스트, 입력 C: \ \ Users \ \ Administrator > npm install express - g, 설치 express 다운로드 대기
메모: node 를 설치 한 후 설치 디 렉 터 리 의 보안 권한 을 쓰기 가능 하고 수정 가능 한 것 으로 설정 해 야 합 니 다. 그렇지 않 으 면 npm 로 다른 패 키 지 를 설치 하 는 데 성공 하지 못 할 수도 있 습 니 다. node 디 렉 터 리 에 두 개의 디 렉 터 리 'node cache', 'node global' 을 만 들 수 있 기 때 문 입 니 다. 물론 두 개의 디 렉 터 리 를 직접 만 들 고 권한 을 설정 할 수도 있 습 니 다.
결과 되 돌리 기:
C:\Users\Administrator>npm install express -g

[email protected] C:\Program Files
odejs
ode_global
ode_modules\express ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ([email protected]) ├── [email protected] ([email protected]) ├── [email protected] ([email protected], [email protected]) ├── [email protected] ([email protected], [email protected]) ├── [email protected] ([email protected], [email protected], [email protected]) ├── [email protected] ([email protected], [email protected]) └── [email protected] ([email protected])

방금 설 치 된 express 테스트
1. 노드 를 입력 하여 노드 진입
2. require ('express') 를 입력 하고 다음 결 과 를 되 돌려 설치 성공 을 설명 합 니 다.
메모: 위의 명령 을 실행 하기 전에 필요 합 니 다.
환경 변수 대화 상자 에 들 어가 시스템 변수 에서 새로 만 듭 니 다. "
NODE PATH ", 입력"
C: \ Program Filesodejsode globalode modules "라 는 단 계 는 상당히 중요 합 니 다.
위의 사용자 변 수 는 다음 과 같이 변경 해 야 합 니 다. (사용자 변수 "PATH" 는 "C: \ Program Filesodejsode 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
odejs
ode_global\weinre -> C:\Program Files
odejs
ode_globa l
ode_modules\weinre\weinre [email protected] C:\Program Files
odejs
ode_global
ode_modules\weinr e ├── [email protected] ├── [email protected] ([email protected]) └── [email protected] ([email protected], [email protected], [email protected], [email protected]) 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 서비스 에 접근 할 수 없고 디 버 깅 도 할 수 없습니다.

좋은 웹페이지 즐겨찾기