Npm test cannot find socket.io.js file - node.js
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.
Those are 404 errors for XHR requests. It doesn't mean that the file does not exist in the file system but that it is not served by accessing that particular path. It is unlikely that your server serves the entire file system so you shouldn't be worried if the file exists there or not but if it is being served from a particular URL that your program is trying to access it from.
See the code examples in this answer for an example:
Getting data from/writing data to localhost with Express
Here the socket.io.js file is referenced in HTML as:
<script src="/socket.io/socket.io.js"></script>
not as an absolute path in the file system, and not with a path including node_modules. Paths in the HTTP requests and paths in the file system are a different thing and 404 errors are HTTP-specific.
Related
Django+Vue:static file not found
When I use Django+Vue to build a web appliction, It occoured that the staic files always not found though I had placed all the files correctly. the logs from server like this: WARNING Not Found: /static/js/app.4c2224dc.js WARNING Not Found: /static/css/app.a5d43e07.css WARNING Not Found: /static/css/chunk-vendors.2ccfa1b8.css WARNING Not Found: /static/js/chunk-vendors.c2488b8d.js WARNING "GET /static/js/app.4c2224dc.js HTTP/1.1" 404 179 WARNING "GET /static/css/app.a5d43e07.css HTTP/1.1" 404 179 WARNING "GET /static/css/chunk-vendors.2ccfa1b8.css HTTP/1.1" 404 179 WARNING "GET /static/js/chunk-vendors.c2488b8d.js HTTP/1.1" 404 179 WARNING Not Found: /login WARNING "GET /login HTTP/1.1" 404 179 WARNING Not Found: //performanceProject WARNING "GET //performanceProject HTTP/1.1" 404 179 WARNING Not Found: /performanceProject WARNING "GET /performanceProject HTTP/1.1" 404 179
I solved the problem by https://www.cnpython.com/qa/1400788. 1、pip3 install whitenoise 2、modify settings.py add 'whitenoise.middleware.WhiteNoiseMiddleware' to MIDDLEWARE, example below: MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', # Add WhiteNoise here ... ] # when DEBUG=true # STATICFILES_DIRS = [ # os.path.join(BASE_DIR, 'dist/static') # ] # when debug=False STATIC_ROOT = os.path.join(BASE_DIR, 'dist/static') # always need to be set ignore debug=False or True STATICFILES_STORAGE = 'whitenoise.storage.CompressedStaticFilesStorage' 3、python3 manage.py collectstatic 4、python3 manage.py runserver 0.0.0.0:XXXX
Uploading to Artifactory fails sometime randomaly
As part of my CI/CD part of our pipeline is to upload artifacts to our local Artifactory server for deployment sometimes randomly this message pops up (estimably week of no-usage) and fails the pipeline 09:23:16 [Error] Server response: 401 Unauthorized 09:23:16 { 09:23:16 "errors": [ 09:23:16 { 09:23:16 "status": 401, 09:23:16 "message": "Token failed verification: expired" 09:23:16 } 09:23:16 ] 09:23:16 } 09:23:16 [Error] Server response: 401 Unauthorized 09:23:16 { 09:23:16 "errors": [ 09:23:16 { 09:23:16 "status": 401, 09:23:16 "message": "Token failed verification: expired" 09:23:16 } 09:23:16 ] 09:23:16 } After I just login to the server and log off it goes back to the normal message: 11:07:49 [Info] Searching items to download... 11:07:49 [Info] [Thread 2] Downloading Repo/xxx.tar.gz 11:07:49 [Info] [Thread 0] Downloading Repo/yyy.tar.gz 11:07:49 [Info] [Thread 2] [2]: 206 Partial Content... 11:07:49 [Info] [Thread 0] [0]: 206 Partial Content... 11:07:49 [Info] [Thread 2] [0]: 206 Partial Content... 11:07:49 [Info] [Thread 2] [1]: 206 Partial Content... 11:07:49 [Info] [Thread 0] [1]: 206 Partial Content... 11:07:49 [Info] [Thread 0] [2]: 206 Partial Content... 11:07:49 [Info] [Thread 2] Done downloading. 11:07:49 [Info] [Thread 0] Done downloading. 11:07:49 { 11:07:49 "status": "success", 11:07:49 "totals": { 11:07:49 "success": 2, 11:07:49 "failure": 0 11:07:49 } 11:07:49 } I use API key from our servers to connect to the Artifactory server with jfrog-cli Any suggestions what might make it happen?
Could you please confirm if the issue is specific to the repositories that are a part of NuGet packaging by any chance and also having the anonymous access enabled for the Artifactory instance? If yes, consider configuring the "Force authentication" for the concerned repository that is a part of this build. This should help in overcoming the reported issue.
How could I handle the Err of TLS certificate with fabric-sdk-node
I'm trying to build a web front end of a fabric-network, and after I completed the registerAdmin and registerUser, I got err when I was tring to run my js code. root#oyu-virtual-machine:~/hyperledger-fabric/test/webapp# node get.js Load privateKey and signedCert Get History Assigning transaction_id: 35e9ed932366df66448d789fbf5989e6ba31be555f96eaca3197475a1602749c E0429 15:09:28.130483373 4413 ssl_transport_security.cc:1245] Handshake failed with fatal error SSL_ERROR_SSL: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed. returned from gethistory Gethistory result count = 1 error from gethistory = Error: 14 UNAVAILABLE: failed to connect to all addresses at Object.exports.createStatusError (/root/hyperledger-fabric/test/webapp/node_modules/fabric-client/node_modules/grpc/src/common.js:91:15) at Object.onReceiveStatus (/root/hyperledger-fabric/test/webapp/node_modules/fabric-client/node_modules/grpc/src/client_interceptors.js:1209:28) at InterceptingListener._callNext (/root/hyperledger-fabric/test/webapp/node_modules/fabric-client/node_modules/grpc/src/client_interceptors.js:568:42) at InterceptingListener.onReceiveStatus (/root/hyperledger-fabric/test/webapp/node_modules/fabric-client/node_modules/grpc/src/client_interceptors.js:618:8) at callback (/root/hyperledger-fabric/test/webapp/node_modules/fabric-client/node_modules/grpc/src/client_interceptors.js:847:24) { code: 14, metadata: Metadata { _internal_repr: {}, flags: 0 }, details: 'failed to connect to all addresses' } Response is Error: 14 UNAVAILABLE: failed to connect to all addresses In my opinion, the most important message is E0429 15:09:28.130483373 4413 ssl_transport_security.cc:1245] Handshake failed with fatal error SSL_ERROR_SSL: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed. It's not generated by my code, but system generated it. I do hope someone could help me. Thanks in advance.
My lambda function randomly crashes and throws a socket hang up error
I have serverless API which saves and fetch data in Redis mostly it runs fine but randomly throws 502 error (socket hang up) which I can't even handle inside the lambda. "errorType": "Error", "errorMessage": "socket hang up", "code": "ECONNRESET", "stack": [ "Error: socket hang up", " at createHangUpError (_http_client.js:323:15)", " at TLSSocket.socketOnEnd (_http_client.js:426:23)", " at TLSSocket.emit (events.js:203:15)", " at endReadableNT (_stream_readable.js:1143:12)", " at process._tickCallback (internal/process/next_tick.js:63:19)" ] }``` I am using: Nodejs 12.x Redis: 2.8.0
AWS Lambda functions have a timeout of 3-900 seconds, with 3 seconds being the default. If your Lambda does not have the timeout configured, and it takes more than 3 seconds to execute, you will get these errors. https://docs.aws.amazon.com/lambda/latest/dg/resource-model.html
Sauce Labs with protractor, malformed URI
My protractor config is: exports.config = { baseUrl: 'http://www.onet.pl', directConnect: false, sauceUser: 'myuser', sauceKey: 'mypassword', capabilities: { 'browserName': 'chrome', 'chromeOptions': { 'args': ['show-fps-counter=true', '--allow-running-insecure-content'] } }, } When I try to launch the tests I get the following Error: [12:57:56] I/sauce - Using SauceLabs selenium server at http://ondemand.saucelabs.com:80/wd/hub [12:57:56] I/launcher - Running 1 instances of WebDriver [12:57:56] E/launcher - URI malformed [12:57:56] E/launcher - URIError: URI malformed at decodeURIComponent (native) at Url.parse (url.js:275:19) at Object.urlParse [as parse] (url.js:81:5) at new HttpClient (C:\Users\gwk736\Gitlab\Inform\e2e\node_modules\selenium-webdriver\http\index.js:221:25) at C:\Users\gwk736\Gitlab\Inform\e2e\node_modules\selenium-webdriver\executors.js:47:18 at ManagedPromise.invokeCallback_ (C:\Users\gwk736\Gitlab\Inform\e2e\node_modules\selenium-webdriver\lib\promise.js:1379:14) at TaskQueue.execute_ (C:\Users\gwk736\Gitlab\Inform\e2e\node_modules\selenium-webdriver\lib\promise.js:2913:14) at TaskQueue.executeNext_ (C:\Users\gwk736\Gitlab\Inform\e2e\node_modules\selenium-webdriver\lib\promise.js:2896:21) at asyncRun (C:\Users\gwk736\Gitlab\Inform\e2e\node_modules\selenium-webdriver\lib\promise.js:2820:25) at C:\Users\gwk736\Gitlab\Inform\e2e\node_modules\selenium-webdriver\lib\promise.js:639:7 [12:57:56] E/launcher - Process exited with error code 199 Anyone encountered this problem when running tests ? This is a very strange behaviour to me... Unfortunately no examples can be found.
I was able to replicate your error by having incorrectly encoded characters in either sauceUser or sauceKey. Can you check if you have any such characters in your config? sauceUser: 'myuser', sauceKey: 'password%EA', Error Stack: [14:41:46] I/sauce - Using SauceLabs selenium server at http://ondemand.saucelabs.com:80/wd/hub [14:41:46] I/launcher - Running 1 instances of WebDriver [14:41:46] E/launcher - URI malformed [14:41:46] E/launcher - URIError: URI malformed at decodeURIComponent (native) at Url.parse (url.js:195:19) at Object.urlParse [as parse] (url.js:84:5) This issue in nodeJs has been explained in this nodejs git issue I just ran into this error when a client encoded 'ê' as '%EA' and an 'é' as "%E9" and then sent them to my node server. Attempting to decode either of them result in the uri malformed error: decodeURIComponent("%EA"); URIError: URI malformed at decodeURIComponent (native) at repl:1:1