lundi 24 avril 2017

Npm test cannot find socket.io.js file

I am trying to make tests using Karma and i am following Angulars own testing guide. Currently i am using the most basic test class but having issues running it.

The test class:

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

When i run it using npm test i get the following error in the command prompt:

 [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]   } 

I have checked the file that it cannot find and it exists in the directory stated by the error so i have no clue what to do.

Aucun commentaire:

Enregistrer un commentaire