maciejtreder / ng-toolkit

:star: Angular tool-box! Start your PWA in two steps! Add Serverless support for existing projects and much more
https://www.angular-universal-pwa.maciejtreder.com
MIT License
1.12k stars 156 forks source link

'socket hang up' happens when to install #548

Open JunjiUmeno opened 5 years ago

JunjiUmeno commented 5 years ago

I'm submitting a...


[X] Bug report  
[ ] Feature request
[ ] Documentation issue or request

In package


[ ] @ng-toolkit/init
[X] @ng-toolkit/serverless
[ ] @ng-toolkit/universal
[ ] @ng-toolkit/pwa
[ ] @ng-toolkit/firebug

Current behavior

When ng add @ng-toolkit/serverless I got an error

Error: socket hang up at createHangUpError (_http_client.js:323:15) at TLSSocket.socketOnEnd (_http_client.js:426:23) at TLSSocket.emit (events.js:187:15) at TLSSocket.EventEmitter.emit (domain.js:441:20) at endReadableNT (_stream_readable.js:1094:12) at process._tickCallback (internal/process/next_tick.js:63:19) Emitted 'error' event at: at TLSSocket.socketOnEnd (_http_client.js:426:9) at TLSSocket.emit (events.js:187:15) [... lines matching original stack trace ...] at process._tickCallback (internal/process/next_tick.js:63:19) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! serverless@1.26.1 postinstall: node ./scripts/postinstall.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the serverless@1.26.1 postinstall 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! /home/um/.npm/_logs/2019-01-09T22_46_00_121Z-debug.log

Expected behavior

Install is completed.

Minimal reproduction of the problem with instructions

Example repository

What is the motivation / use case for changing the behavior?

Environment


Angular CLI: 7.2.1
Node: 10.14.2
OS: linux x64
Angular: 7.2.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.12.1
@angular-devkit/build-angular     0.12.1
@angular-devkit/build-optimizer   0.12.1
@angular-devkit/build-webpack     0.12.1
@angular-devkit/core              7.2.1
@angular-devkit/schematics        7.2.1
@angular/cli                      7.2.1
@ngtools/webpack                  7.2.1
@schematics/angular               7.2.1
@schematics/update                0.12.1
rxjs                              6.3.3
typescript                        3.2.2
webpack                           4.23.1

Others:

mohammedzamakhan commented 5 years ago

Same here 😢

SouengKimmeng commented 5 years ago

+1

fluxconn-derick commented 5 years ago

+1 ng add @ng-toolkit/serverless --provider aws

following walk through from https://www.youtube.com/watch?v=N-6LtzJezsk

I get

spawn-sync@1.0.15 postinstall D:.. ..\node_modules\spawn-sync node postinstall

serverless@1.26.1 postinstall D:.. ..\node_modules\serverless node ./scripts/postinstall.js

events.js:167 throw er; // Unhandled 'error' event ^

Error: socket hang up at createHangUpError (_http_client.js:323:15) at TLSSocket.socketOnEnd (_http_client.js:426:23) at TLSSocket.emit (events.js:187:15) at TLSSocket.EventEmitter.emit (domain.js:441:20) at endReadableNT (_stream_readable.js:1094:12) at process._tickCallback (internal/process/next_tick.js:63:19) Emitted 'error' event at: at TLSSocket.socketOnEnd (_http_client.js:426:9) at TLSSocket.emit (events.js:187:15) [... lines matching original stack trace ...] at process._tickCallback (internal/process/next_tick.js:63:19) npm WARN @ng-toolkit/pwa@1.1.50 requires a peer of @angular/common@~7.0.0 but none is installed. You must install peer dependencies yourself. npm WARN @ng-toolkit/pwa@1.1.50 requires a peer of @angular/core@~7.0.0 but none is installed. You must install peer dependencies yourself. npm WARN @ng-toolkit/pwa@1.1.50 requires a peer of @angular/service-worker@~7.0.0 but none is installed. You must install peer dependencies yourself. npm WARN @ng-toolkit/universal@1.1.50 requires a peer of @angular/common@~7.0.0 but none is installed. You must install peer dependencies yourself. npm WARN @ng-toolkit/universal@1.1.50 requires a peer of @angular/core@~7.0.0 but none is installed. You must install peer dependencies yourself. npm WARN The package ts-loader is included as both a dev and production dependency. npm WARN The package webpack-cli is included as both a dev and production dependency. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! serverless@1.26.1 postinstall: node ./scripts/postinstall.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the serverless@1.26.1 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Running on ..

Angular CLI: 7.2.3 Node: 10.15.0 OS: win32 x64 Angular: 7.2.2 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, platform-server, router

Package Version

@angular-devkit/architect 0.12.3 @angular-devkit/build-angular 0.12.3 @angular-devkit/build-optimizer 0.12.3 @angular-devkit/build-webpack 0.12.3 @angular-devkit/core 7.2.3 @angular-devkit/schematics 7.2.3 @angular/cli 7.2.3 @ngtools/webpack 7.2.3 @schematics/angular 7.2.3 @schematics/update 0.12.3 rxjs 6.3.3 typescript 3.2.4 webpack 4.28.4

yinchang0626 commented 5 years ago

+1

mohammedzamakhan commented 5 years ago

@maciejtreder pls add a label to this issue

evayde commented 5 years ago

This seems to be a problem with specific Node versions. I have experienced this issue on 10.6.0, but 9.11.1 for example is working as intended. After installing you can also switch back to the newer Version and go on with your business.

mohammedzamakhan commented 5 years ago

@evayde yes we can do that switching, but its not ideal. its a temporary fix for now, but we need latest node version to not throw this error, and work smoothly.

adskiremote commented 5 years ago

I was able to resolve this issue but after first failure on postinstall - upgrade the dependencies and devDependencies. Then re-run npm install.

My current package.json file dependencies:

"dependencies": { "@angular/animations": "~7.2.10", "@angular/cdk": "^7.3.5", "@angular/common": "~7.2.10", "@angular/compiler": "~7.2.10", "@angular/core": "~7.2.10", "@angular/forms": "~7.2.10", "@angular/http": "^7.2.10", "@angular/material": "^7.3.5", "@angular/platform-browser": "~7.2.10", "@angular/platform-browser-dynamic": "~7.2.10", "@angular/platform-server": "^7.2.10", "@angular/router": "~7.2.10", "@angular/service-worker": "^7.2.10", "@ng-toolkit/serverless": "^1.1.51", "@nguniversal/express-engine": "^7.1.1", "@nguniversal/module-map-ngfactory-loader": "^7.1.1", "@ngx-translate/core": "^11.0.1", "@ngx-translate/http-loader": "^4.0.0", "aws-serverless-express": "^3.3.5", "core-js": "^2.6.5", "cors": "~2.8.5", "cp-cli": "^2.0.0", "rxjs": "~6.4.0", "tslib": "^1.9.3", "typescript-collections": "^1.3.2", "webpack-cli": "3.3.0", "zone.js": "~0.8.29" }, "devDependencies": { "@angular-devkit/build-angular": "^0.13.6", "@angular/cli": "~7.3.6", "@angular/compiler-cli": "~7.2.10", "@angular/language-service": "~7.2.10", "@types/jasmine": "~3.3.12", "@types/jasminewd2": "~2.0.6", "@types/node": "~11.11.4", "codelyzer": "~4.5.0", "cp-cli": "^2.0.0", "cpy-cli": "^2.0.0", "decompress": "^4.2.0", "decompress-targz": "^4.1.1", "express": "^4.16.4", "http-server": "^0.11.1", "jasmine-core": "~3.3.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~4.0.1", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.5", "karma-jasmine": "~2.0.1", "karma-jasmine-html-reporter": "^1.4.0", "karma-phantomjs-launcher": "^1.0.4", "node-wget": "^0.4.3", "npm-run-all": "^4.1.5", "opencollective": "^1.0.3", "pre-commit": "^1.2.2", "protractor": "~5.4.2", "reflect-metadata": "^0.1.13", "serverless": "1.39.1", "serverless-apigw-binary": "^0.4.4", "sinon": "^7.3.0", "ts-loader": "5.3.3", "ts-node": "~8.0.3", "tslint": "^5.14.0", "typescript": "~3.2.2", "webpack-cli": "3.3.0" },