2016-09-07 1 views
0

여기에 문제가 있습니다. phamtomJS 2.1.1을 사용하고 있으며 reactJS + typescript로 작성된 웹 페이지를 열고 System.import 중에 예외가 발생합니다. .PhantomJS - System.import를 사용하여 js 파일을로드하는 중 오류가 발생했습니다.

된 index.html의 코드 : mount.tsx의

<div id="__Mount"></div> 

<script src="lib/systemjs/dist/system.src.js"></script> 
<script src="lib/react/dist/phantomjs-shims.js"></script> 

<!-- build:js --> 
<!-- endbuild --> 

<!-- build:systemjs_config --> 
<script> 
    System.config({ 
     baseURL: './lib', 
     paths: { 
      "react*": 'react/dist/react-with-addons', 
      "react-dom": 'react-dom/dist/react-dom', 
      "jquery": 'kendoui/js/jquery.min', 
      "bootstrap": 'bootstrap/dist/js/npm' 
     } 
    }); 

    System.defaultJSExtensions = true; 
</script> 
<!-- endbuild --> 

<script> 
    System.import('client/mount').catch(function(e) 
    { 
     console.error(e); 
    }); 
</script> 

코드 :

import * as React from 'react'; 
import * as ReactDOM from 'react-dom'; 

import {App} from './app'; 

ReactDOM.render(<App/>, document.querySelector("#__Mount")); 

을 그리고 켜져 있어야합니다 모든 논리를 가진 app.tsx이있다 그 페이지. test.js의

ERROR: Error: (SystemJS) [email protected][native code] [email protected]http://127.0.0.1:8080/lib/systemjs/dist/system.src.js:1544:18 [email protected]http://127.0.0.1:8080/lib/systemjs/dist/system.src.js:4005:22 [email protected]http://127.0.0.1:8080/lib/systemjs/dist/system.src.js:3281:36 [email protected]http://127.0.0.1:8080/lib/systemjs/dist/system.src.js:3124:28 [email protected]http://127.0.0.1:8080/lib/systemjs/dist/system.src.js:3491:17 [email protected]http://127.0.0.1:8080/lib/systemjs/dist/system.src.js:774:32 [email protected]http://127.0.0.1:8080/lib/systemjs/dist/system.src.js:972:36 [email protected]http://127.0.0.1:8080/lib/systemjs/dist/system.src.js:631:11 [email protected]http://127.0.0.1:8080/lib/systemjs/dist/system.src.js:677:24 http://127.0.0.1:8080/lib/systemjs/dist/system.src.js:493:30 Evaluating http://127.0.0.1:8080/lib/client/mount.js Error loading http://127.0.0.1:8080/lib/client/mount.js

코드 :

var page = require('webpage').create(); 
page.onError = function(msg) { 
    console.log("On error message "+msg); 
}; 
page.open('http://127.0.0.1:8080/', function (status) { 
    console.log("status is: " + status); 
    if (status === "success") { 
     console.log("success"); 
     setTimeout(function() { 
      console.log("screenshot"); 
      page.render('screenshot.png'); 

      var js = page.evaluate(function() { 
       return document; 
      }); 
      console.log(js.all[0].outerHTML); 

      phantom.exit(); 

     }, 10000); 
    } 
    else { 
     console.log("not success"); 
     phantom.exit(); 
    } 
}); 

정말 그것을 강타하고 나에게 오류를 제공

phantomjs test.js http://127.0.0.1:8080 

: 난 다음 명령을 사용하여 콘솔에서 phantomjs을 실행 나는 길을 찾을 수 없다. 어떤 도움이나 힌트를 주시면 감사하겠습니다.

답변

관련 문제