1
我正在嘗試使用Karma進行測試,我正在關注Angulars自己的測試指南。目前,我正在使用最基本的測試課程,但在運行時遇到問題。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] }
我已經檢查了它無法找到該文件並將其存在於錯誤所述的目錄中,所以我不知道該怎麼做。
但我如何解決這個錯誤對我來說?我真的不知道要改變什麼以及在哪裏。 – MoeTheBro