Base solution for your next web application
Open Closed

node server crashes #9314


User avatar
0
TimMackey created

ANZ version 8.0.0

Successful "npm start":

** Angular Live Development Server is listening on 0.0.0.0:4200, open your browser on http://localhost:4200/ **
i 「wdm」: Compiled successfully.

In desktop development environment, node server periodically (and frequently) crashes for no known reason:

C:\Users\Tim\Documents\__ngTTMv800\angular\node_modules\webpack-dev-server\lib\servers\SockJSServer.js:67
      f(connection, connection.headers);
                               ^

TypeError: Cannot read property 'headers' of null
    at Server.<anonymous> (C:\Users\Tim\Documents\__ngTTMv800\angular\node_modules\webpack-dev-server\lib\servers\SockJSServer.js:67:32)
    at Server.emit (events.js:223:5)
    at App.emit (C:\Users\Tim\Documents\__ngTTMv800\angular\node_modules\sockjs\lib\sockjs.js:196:29)
    at C:\Users\Tim\Documents\__ngTTMv800\angular\node_modules\sockjs\lib\transport.js:111:25
    at processTicksAndRejections (internal/process/task_queues.js:76:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `gulp buildDev && ng serve --host 0.0.0.0 --port 4200`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Tim\AppData\Roaming\npm-cache\_logs\2020-07-06T18_48_43_977Z-debug.log

The above mentioned ...977Z-debug.log file:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\Tim\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: C:\Users\Tim\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Tim\Documents\__ngTTMv800\angular\node_modules\.bin;C:\Perl64\site\bin;C:\Perl64\bin;C:\Program Files\Microsoft MPI\Bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Git\cmd;C:\Program Files\Microsoft\Web Platform Installer\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files (x86)\Common Files\Acronis\VirtualFile\;C:\Program Files (x86)\Common Files\Acronis\VirtualFile64\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x86)\Common Files\Acronis\FileProtector\;C:\Program Files (x86)\Common Files\Acronis\FileProtector64\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\WinMerge;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\nodejs\;C:\Python\Scripts\;C:\Python\;C:\Users\Tim\AppData\Local\Microsoft\WindowsApps;.bin;C:\Users\Tim\AppData\Local\Programs\Fiddler;C:\SysInternals;C:\Program Files\Microsoft VS Code\bin;C:\Users\Tim\.dotnet\tools;C:\Users\Tim\AppData\Local\Microsoft\WindowsApps;C:\Users\Tim\AppData\Roaming\Python\Python36\Scripts;C:\Users\Tim\AppData\Local\Yarn\bin;C:\Users\Tim\AppData\Roaming\npm;
9 verbose lifecycle [email protected]~start: CWD: C:\Users\Tim\Documents\__ngTTMv800\angular
10 silly lifecycle [email protected]~start: Args: [ '/d /s /c', 'gulp buildDev && ng serve --host 0.0.0.0 --port 4200' ]
11 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `gulp buildDev && ng serve --host 0.0.0.0 --port 4200`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\Tim\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:223:5)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\Tim\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:223:5)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\Users\Tim\Documents\__ngTTMv800\angular
16 verbose Windows_NT 10.0.19041
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Tim\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.15.0
19 verbose npm  v6.13.7
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `gulp buildDev && ng serve --host 0.0.0.0 --port 4200`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

How can I determine the actual cause of this fault? I'm concerned that when deployed the fault will happen and crash the website.


22 Answer(s)
  • User Avatar
    0
    gterdem created
    Support Team

    Hello @timmackey, can you observe your RAM usage while this error occurs?

  • User Avatar
    0
    TimMackey created

    Do you mean system RAM? I have 16 Gigs installed on my dev machine. Client Node.js is 1.5G at startup.
    Dev Studio Diagnostic Tools reports 489M Process Memory at startup. I'll take a snapshot of these memorys next occurrence of the fault. Or should I be looking at something else?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi Tim,

    Can you change gulp buildDev && ng serve --host 0.0.0.0 --port 4200 in package.json to ng serve --host 0.0.0.0 --port 4200 and see if it makes any difference. We are planning to remove gulp buildDev as well since it causes delays in development time.

    I think this is just related to development time.

  • User Avatar
    0
    TimMackey created

    before change:

      "scripts": {
        "ng": "ng",
        "publish": "gulp build && ng build --prod",
        "start": "gulp buildDev && ng serve --host 0.0.0.0 --port 4200",
        "hmr": "gulp buildDev && ng serve --host 0.0.0.0 --port 4200 --hmr",
        "test": "gulp buildDev && ng test",
        "pree2e": "webdriver-manager update --standalone false --gecko false",
        "e2e": "gulp buildDev && protractor",
        "create-dynamic-bundles": "gulp buildDev"
      },
    

    after change:

      "scripts": {
        "ng": "ng",
        "publish": "gulp build && ng build --prod",
        "start": "ng serve --host 0.0.0.0 --port 4200",
        "hmr": "gulp buildDev && ng serve --host 0.0.0.0 --port 4200 --hmr",
        "test": "gulp buildDev && ng test",
        "pree2e": "webdriver-manager update --standalone false --gecko false",
        "e2e": "gulp buildDev && protractor",
        "create-dynamic-bundles": "gulp buildDev"
      },
    

    Thank you for the suggestion.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @timmackey

    Did that fix the problem for you ?

  • User Avatar
    0
    TimMackey created

    So far so good. I need a couple of weeks of dev to make sure it doesn't happen again.

  • User Avatar
    0
    ismcagdas created
    Support Team

    @timmackey

    Thanks, great :).

  • User Avatar
    0
    TimMackey created

    This error keeps happening. Sometimes several times per day.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @timmackey

    Can you reproduce it on a new project ?

  • User Avatar
    0
    TimMackey created

    This error consistently happens in the following scenario:

    1. In Visual Studio Code start debug session with Chrome browser.
    2. login as user [email protected]
    3. use website
    4. logout
    5. open Chrome browser.
    6. navigate to localhost:4200.
    7. login as user [email protected]
    8. node server crashes as soon as home page is displayed.
    C:\Users\Tim\Documents\__ngTTMv800\angular\node_modules\webpack-dev-server\lib\servers\SockJSServer.js:67
          f(connection, connection.headers);
                                   ^
    
    TypeError: Cannot read property 'headers' of null
        at Server.<anonymous> (C:\Users\Tim\Documents\__ngTTMv800\angular\node_modules\webpack-dev-server\lib\servers\SockJSServer.js:67:32)
        at Server.emit (events.js:223:5)
        at App.emit (C:\Users\Tim\Documents\__ngTTMv800\angular\node_modules\sockjs\lib\sockjs.js:196:29)
        at C:\Users\Tim\Documents\__ngTTMv800\angular\node_modules\sockjs\lib\transport.js:111:25
        at processTicksAndRejections (internal/process/task_queues.js:76:11)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! [email protected] start: `ng serve --host 0.0.0.0 --port 4200`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the [email protected] start script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\Tim\AppData\Roaming\npm-cache\_logs\2020-09-17T18_23_20_738Z-debug.log
    

    Current remedy: npm start

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Could you upgrade node to latest version and try again ?

    Thanks,

  • User Avatar
    0
    TimMackey created

    Upgraded to Node.js v12.18.4 (latest). Same error as above sequence:

    C:\Users\Tim\Documents\__ngTTMv800\angular\node_modules\webpack-dev-server\lib\servers\SockJSServer.js:67
          f(connection, connection.headers);
                                   ^
    
    TypeError: Cannot read property 'headers' of null
        at Server.<anonymous> (C:\Users\Tim\Documents\__ngTTMv800\angular\node_modules\webpack-dev-server\lib\servers\SockJSServer.js:67:32)
        at Server.emit (events.js:315:20)
        at App.emit (C:\Users\Tim\Documents\__ngTTMv800\angular\node_modules\sockjs\lib\sockjs.js:196:29)
        at C:\Users\Tim\Documents\__ngTTMv800\angular\node_modules\sockjs\lib\transport.js:111:25
        at processTicksAndRejections (internal/process/task_queues.js:79:11)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! [email protected] start: `ng serve --host 0.0.0.0 --port 4200`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the [email protected] start script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\Tim\AppData\Roaming\npm-cache\_logs\2020-09-18T16_45_48_474Z-debug.log
    
    C:\Users\Tim\Documents\__ngTTMv800\angular>node
    Welcome to Node.js v12.18.4.
    Type ".help" for more information.
    >
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @timmackey

    Sorry for the missing information. I was suggesting node 14.x (Not LTS but current).

    1. Could you upgrade to Node 14.x and try agian ?
    2. Did you try this on any other machine ? If so, did you face the same problem.

    Thanks,

  • User Avatar
    0
    TimMackey created
     「wdm」: Compiled successfully.
     
    C:\Users\Tim\Documents\__ngTTMv800\angular\node_modules\webpack-dev-server\lib\servers\SockJSServer.js:67
          f(connection, connection.headers);
                                   ^
    
    TypeError: Cannot read property 'headers' of null
        at Server.<anonymous> (C:\Users\Tim\Documents\__ngTTMv800\angular\node_modules\webpack-dev-server\lib\servers\SockJSServer.js:67:32)
        at Server.emit (events.js:314:20)
        at App.emit (C:\Users\Tim\Documents\__ngTTMv800\angular\node_modules\sockjs\lib\sockjs.js:196:29)
        at C:\Users\Tim\Documents\__ngTTMv800\angular\node_modules\sockjs\lib\transport.js:111:25
        at processTicksAndRejections (internal/process/task_queues.js:75:11)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! [email protected] start: `ng serve --host 0.0.0.0 --port 4200`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the [email protected] start script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\Tim\AppData\Roaming\npm-cache\_logs\2020-09-25T23_13_53_115Z-debug.log
    
    C:\Users\Tim\Documents\__ngTTMv800\angular>node
    Welcome to Node.js v14.12.0.
    Type ".help" for more information.
    >
    

    Have not tried on another machine. The easiest way to try on another machine would be to clone the SDD and plug disc into another laptop of identical HW. I doubt the outcome would be different, given the OS and all drivers, apps, packages are identical. The hard way would be to install all dev tools, apps and packages from a HDD set to original factory settings, which might have a different outcome. This would take a lot of time, and if the error goes away, the root cause would still remain unknown. Open to other diagnostic suggestions.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @timmackey

    Could you try to download a new Demo project and run the same steps ? If problem doesn't happen, could you share your angular project with us via email (to [email protected]) ?

    Thanks,

  • User Avatar
    0
    TimMackey created

    UPDATE Asp Net Zero version 8.1.0 Core 3.1/angular Angular CLI: 8.3.29 Node: 14.12.0 OS: win32 x64 Angular: 8.2.14

    The error reported in this issue is intermittently occurring only under the following conditions:

    1. Login as host admin
    2. In the Tenant management page, login as a non-admin tenant.
    3. Perform some actions as tenant/user
    4. Return to admin user via "Back to my account".
    5. The reported error occurs.
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @timmackey

    Could you share your Angular app's package.json ?

    Thanks,

  • User Avatar
    0
    TimMackey created

    package.json

    {
      "name": "abp-zero-template",
      "version": "8.1.0",
      "license": "MIT",
      "angular-cli": {},
      "scripts": {
        "ng": "ng",
        "publish": "gulp build && ng build --prod",
        "start": "gulp buildDev && ng serve --host 0.0.0.0 --port 4200",
        "hmr": "gulp buildDev && ng serve --host 0.0.0.0 --port 4200 --hmr",
        "test": "gulp buildDev && ng test",
        "pree2e": "webdriver-manager update --standalone false --gecko false",
        "e2e": "gulp buildDev && protractor",
        "create-dynamic-bundles": "gulp buildDev"
      },
      "private": false,
      "dependencies": {
        "@angular/animations": "^8.2.5",
        "@angular/cdk": "^8.1.4",
        "@angular/common": "^8.2.5",
        "@angular/compiler": "^8.2.5",
        "@angular/core": "^8.2.5",
        "@angular/forms": "^8.2.5",
        "@angular/http": "^7.2.15",
        "@angular/platform-browser": "^8.2.5",
        "@angular/platform-browser-dynamic": "^8.2.5",
        "@angular/platform-server": "^8.2.5",
        "@angular/router": "^8.2.5",
        "@aspnet/signalr": "^1.1.4",
        "@fortawesome/fontawesome-pro": "^5.15.1",
        "@ng-bootstrap/ng-bootstrap": "^5.1.4",
        "@nth-cloud/ng-toggle": "^3.0.3",
        "@swimlane/ngx-charts": "^12.0.1",
        "@types/bootstrap": "^4.3.1",
        "@types/dwt": "^15.2.3",
        "@types/moment": "^2.13.0",
        "abp-ng2-module": "^5.0.0",
        "abp-web-resources": "^4.1.0",
        "adal-angular": "^1.0.17",
        "angular-gridster2": "^8.2.0",
        "angular-oauth2-oidc": "^8.0.4",
        "angular-resizable-element": "3.2.2",
        "angular-resize-event": "^1.1.1",
        "angular2-counto": "^1.2.5",
        "angular2-text-mask": "^9.0.0",
        "animate.css": "^3.7.2",
        "body-scroll-lock": "^3.0.2",
        "cookieconsent": "^3.1.1",
        "core-js": "^3.3.3",
        "dwt": "15.3",
        "famfamfam-flags": "^1.0.0",
        "file-saver": "^2.0.2",
        "js-cookie": "^2.2.1",
        "just-compare": "^1.3.0",
        "localforage": "^1.7.3",
        "lodash": "^4.17.13",
        "moment": "^2.24.0",
        "moment-timezone": "^0.5.27",
        "ng-number-picker": "^1.1.9",
        "ng-recaptcha": "^5.0.0",
        "ng2-file-upload": "^1.4.0",
        "ngx-bootstrap": "^5.2.0",
        "ngx-drag-drop": "^2.0.0",
        "ngx-filesaver": "^8.1.0",
        "ngx-image-cropper": "^1.5.1",
        "ngx-perfect-scrollbar": "^8.0.0",
        "ngx-spinner": "^8.0.3",
        "object-path": "^0.11.4",
        "primeflex": "^1.0.0",
        "primeicons": "^2.0.0",
        "primeng": "7.0.5",
        "push.js": "^1.0.12",
        "quill": "^1.3.7",
        "rtl-detect": "^1.0.2",
        "rxjs": "^6.5.3",
        "simple-line-icons": "^2.4.1",
        "spin.js": "^4.1.0",
        "sweetalert2": "^8.18.6",
        "text-mask-addons": "^3.8.0",
        "typescript": "3.4.5",
        "typescript-string-operations": "^1.3.1",
        "webdriver-manager": "^12.1.7",
        "zone.js": "~0.10.2"
      },
      "devDependencies": {
        "@angular-devkit/build-angular": "~0.803.3",
        "@angular/cli": "^8.3.3",
        "@angular/compiler-cli": "^8.2.5",
        "@angularclass/hmr": "^2.1.3",
        "@angularclass/hmr-loader": "^3.0.4",
        "@types/jasmine": "~3.4.0",
        "@types/jasminewd2": "^2.0.8",
        "@types/lodash": "^4.14.144",
        "@types/moment-timezone": "^0.5.12",
        "@types/node": "^12.11.6",
        "codelyzer": "^5.2.0",
        "gulp": "^4.0.1",
        "gulp-clean-css": "^4.2.0",
        "gulp-concat": "^2.6.1",
        "gulp-less": "^4.0.1",
        "gulp-postcss": "^8.0.0",
        "gulp-uglify": "^3.0.2",
        "jasmine-core": "~3.4.0",
        "jasmine-spec-reporter": "^4.2.1",
        "karma": "^4.4.1",
        "karma-chrome-launcher": "~3.1.0",
        "karma-cli": "~2.0.0",
        "karma-coverage-istanbul-reporter": "^2.1.0",
        "karma-jasmine": "~2.0.1",
        "karma-jasmine-html-reporter": "^1.4.2",
        "merge-stream": "^2.0.0",
        "nswag": "13.0.6",
        "postcss-url": "^9.0.0",
        "protractor": "~5.4.2",
        "ts-node": "~8.3.0",
        "tslib": "1.10.0",
        "tslint": "~5.19.0"
      }
    }
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi Tim,

    Thanks. Do you run the Angular app from VS Code ? If so, could you try running it from command line and see if it causes the same problem.

    You can also try to add a direct dependency as explained here to webpack/webpack-dev-server and see if it fixes the problem.

  • User Avatar
    0
    TimMackey created

    The error reported above has stopped occurring; cause unknown.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @timmackey

    I tihnk upgrading some of the NPM packages fixed this problem.

  • User Avatar
    0
    TimMackey created

    This error has reappeared.

    Unable to reproduce exact steps. Has something to do with debugging in VS Code and running the debugger in VS Code.