2017-04-24 13 views
1

私はカルマを使ってテストをしようとしており、私はアンギュラ自身のテストガイドに従っています。現在、私は最も基本的なテストクラスを使用していますが、問題を実行しています。Npmテストでsocket.io.jsファイルが見つかりません

テストクラス:

describe('1st test',()=>{ 
it('true is true',()=> expect(true).toBe(true)); }); 

私はNPMのテストを使用して、それを実行すると、私は、コマンドプロンプトで次のエラーを取得:

[1] 24 04 2017 11:27:24.957:WARN [web-server]: 404: /base/node_modules/socket.io-client/dist/socket.io.js 
[1] Chrome 57.0.2987 (Windows 10 0.0.0) ERROR 
[1] { 
[1]  "__zone_symbol__error": { 
[1]  "originalStack": "Error: (SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js", 
[1]  "zoneAwareStack": "Error: (SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js" 
[1]  }, 
[1]  "stack": "(SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js", 
[1]  "name": "Error", 
[1]  "message": "(SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js", 
[1]  "originalStack": "Error: (SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js", 
[1]  "zoneAwareStack": "Error: (SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js", 
[1]  "__zone_symbol__stack": "(SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js", 
[1]  "originalErr": { 
[1]  "__zone_symbol__error": { 
[1]   "originalStack": "Error: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js", 
[1]   "zoneAwareStack": "Error: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js" 
[1]  }, 
[1]  "stack": "Error: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js", 
[1]  "name": "Error", 
[1]  "message": "XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js", 
[1]  "originalStack": "Error: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js", 
[1]  "zoneAwareStack": "Error: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js", 
[1]  "__zone_symbol__currentTask": { 
[1]   "type": "microTask", 
[1]   "state": "notScheduled", 
[1]   "source": "Promise.then", 
[1]   "zone": "<root>", 
[1]   "cancelFn": null, 
[1]   "runCount": 0 
[1]  }, 
[1]  "__zone_symbol__stack": "Error: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js", 
[1]  "__zone_symbol__message": "XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js", 
[1]  "__zone_symbol__name": "Error", 
[1]  "__zone_symbol__originalStack": "Error: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js", 
[1]  "__zone_symbol__zoneAwareStack": "Error: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js" 
[1]  }, 
[1]  "__zone_symbol__currentTask": { 
[1]  "type": "microTask", 
[1]  "state": "notScheduled", 
[1]  "source": "Promise.then", 
[1]  "zone": "<root>", 
[1]  "cancelFn": null, 
[1]  "runCount": 0 
[1]  }, 
[1]  "__zone_symbol__name": "Error", 
[1]  "__zone_symbol__message": "(SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js", 
[1]  "__zone_symbol__originalStack": "Error: (SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js", 
[1]  "__zone_symbol__zoneAwareStack": "Error: (SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js" 
[1] } 
[1] 
[1] Chrome 57.0.2987 (Windows 10 0.0.0) ERROR 
[1] { 
[1]  "__zone_symbol__error": { 
[1]  "originalStack": "Error: (SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js", 
[1]  "zoneAwareStack": "Error: (SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js" 
[1]  }, 
[1]  "stack": "(SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js", 
[1]  "name": "Error", 
[1]  "message": "(SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js", 
[1]  "originalStack": "Error: (SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js", 
[1]  "zoneAwareStack": "Error: (SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js", 
[1]  "__zone_symbol__stack": "(SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js", 
[1]  "originalErr": { 
[1]  "__zone_symbol__error": { 
[1]   "originalStack": "Error: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js", 
[1]   "zoneAwareStack": "Error: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js" 
[1]  }, 
[1]  "stack": "Error: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js", 
[1]  "name": "Error", 
[1]  "message": "XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js", 
[1]  "originalStack": "Error: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js", 
[1]  "zoneAwareStack": "Error: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js", 
[1]  "__zone_symbol__currentTask": { 
[1]   "type": "microTask", 
[1]   "state": "notScheduled", 
[1]   "source": "Promise.then", 
[1]   "zone": "<root>", 
[1]   "cancelFn": null, 
[1]   "runCount": 0 
[1]  }, 
[1]  "__zone_symbol__stack": "Error: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js", 
[1]  "__zone_symbol__message": "XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js", 
[1]  "__zone_symbol__name": "Error", 
[1]  "__zone_symbol__originalStack": "Error: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js", 
[1]  "__zone_symbol__zoneAwareStack": "Error: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js" 
[1]  }, 
[1]  "__zone_symbol__currentTask": { 
[1]  "type": "microTask", 
[1]  "state": "notScheduled", 
[1]  "source": "Promise.then", 
[1]  "zone": "<root>", 
[1]  "cancelFn": null, 
[1]  "runCount": 0 
[1]  }, 
[1]  "__zone_symbol__name": "Error", 
[1]  "__zone_symbol__message": "(SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js", 
[1]  "__zone_symbol__originalStack": "Error: (SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js", 
[1]  "__zone_symbol__zoneAwareStack": "Error: (SystemJS) XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError: XHR error (404 Not Found) loading src/node_modules/socket.io-client/dist/socket.io.js\n\tError loading src/node_modules/socket.io-client/dist/socket.io.js as \"socket.io-client\" from src/app/global/socket.service.js" 
[1] } 

を、私はそれを見つけ、それができないファイルをチェックしていますエラーで示されたディレクトリに存在するので、何をすべきかわからない。

答えて

0

XHRリクエストでは404エラーです。これは、ファイルがファイルシステムに存在しないことを意味するのではなく、特定のパスにアクセスすることによってサービスされないことを意味します。あなたのサーバーがファイルシステム全体を扱うことはほとんどありませんので、そこにファイルが存在するかどうか心配する必要はありませんが、プログラムがアクセスしようとしている特定のURLから提供されている場合は心配する必要はありません。

例えばこの回答のコード例を参照してください:ここで

socket.io.jsファイルは次のようにHTMLで参照されています。

絶対パスとして
<script src="/socket.io/socket.io.js"></script> 

ありませんファイルシステムでは、node_modulesを含むパスではなく、ファイルシステム内のHTTP要求とパスのパスは異なるものであり、404エラーはHTTP固有です。

+0

しかし、私はこのエラーを私のために修正しますか?私は何を変えるべきか、どこでどこを変えるのか本当に分かりません。 – MoeTheBro

関連する問題