2017-07-13 9 views
1

Gitからリポジトリをダウンロードして修正しましたが、コンパイルして実行できないようです。 これはionic1ベースのプロジェクトであったため、@ ionic/cli-pl ugin-gulpと@ ionic/cli-plugin-ionic1というノードモジュールをインストールするように求められました。ionic serveで実行しようとするとイオンエラーが発生する

私はこのエラーを受信し続ける:以下

C:\Users\User1\Desktop\belfastsalah-master\belfastsalah-master\node_modules\@ionic\cli-plugin-ionic1\dist\serve\live-reload.js:19 
let contentStr = content.toString(); 
         ^

TypeError: Cannot read property 'toString' of undefined 
at Object.injectLiveReloadScript (C:\Users\User1\Desktop\belfastsalah-master\belfastsalah-master\node_modules\@ionic\cli-plugin-ionic1\dist\serve\live-reload.js:19:29) 
at ReadFileContext.fs.readFile [as callback] (C:\Users\User1\Desktop\belfastsalah-master\belfastsalah-master\node_modules\@ionic\cli-plugin-ionic1\dist\serve\http-server.js:59:39) 
at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:366:13) 

は、エラーが表示されますただしで、これは私が変更されていないJSファイルからコードです。これは私が上記のようにインストールするように求められたものです。

"use strict"; 
Object.defineProperty(exports, "__esModule", { value: true }); 
const path = require("path"); 
const modules_1 = require("../lib/modules"); 
function createLiveReloadServer(options) { 
    const tinylr = modules_1.load('tiny-lr'); 
    const liveReloadServer = tinylr(); 
    liveReloadServer.listen(options.livereloadPort, options.address); 
    return (changedFiles) => { 
     liveReloadServer.changed({ 
      body: { 
       files: changedFiles.map(changedFile => ('/' + path.relative(options.wwwDir, changedFile))) 
      } 
     }); 
    }; 
} 
exports.createLiveReloadServer = createLiveReloadServer; 
function injectLiveReloadScript(content, host, port) { 
    let contentStr = content.toString(); 
    const liveReloadScript = getLiveReloadScript(host, port); 
    if (contentStr.indexOf('/livereload.js') > -1) { 
     return content; 
    } 
    let match = contentStr.match(/<\/body>(?![\s\S]*<\/body>)/i); 
    if (!match) { 
     match = contentStr.match(/<\/html>(?![\s\S]*<\/html>)/i); 
    } 
    if (match) { 
     contentStr = contentStr.replace(match[0], `${liveReloadScript}\n${match[0]}`); 
    } 
    else { 
     contentStr += liveReloadScript; 
    } 
    return contentStr; 
} 
exports.injectLiveReloadScript = injectLiveReloadScript; 
function getLiveReloadScript(host, port) { 
    if (host === '0.0.0.0') { 
     host = 'localhost'; 
    } 
    const src = `//${host}:${port}/livereload.js?snipver=1`; 
    return ` <!-- Ionic Dev Server: Injected LiveReload Script -->\n` + ` <script src="${src}" async="" defer=""></script>`; 
} 

ご協力いただければ幸いです。 おかげ

+0

あなたはどのバージョンのCordovaを使用していますか? – Sam5487

+0

@ Sam5487 Cordovaバージョンは7.0.1 – Adam

+0

@ Sam5487それはどんな助けでもかまいませんか? – Adam

答えて

0

あなたがすべきチェック場合は、すべてのバンドル/生成が行われた後、WWW/index.htmlを

はそれがなくなっているとの結果、何のindex.html世代との広範な実験の後に、この問題を抱えていた存在します;)

関連する問題