npm install fails with message "Error: socket hang up" - javascript

I met this problem when execute the npm install module-name --save
It fails no matter what I install.
And it fails if I specified it in the package.json . and then run the npm install for the whole project.
There are some similar question posted like
NPM doesn't install any modules: network socket hangs up
NodeJS - What does "socket hang up" actually mean?
but unfortunately, it doesn't work for me. Also, npm install is OK with my other projects.
My environment: npm v6.4.1, node.js v10.10.0 serverless v1.28.0
Appreciated for the help of any kinds.
Here is my log message in my console:
> spawn-sync#1.0.15 postinstall /Users/pro/node_modules/spawn-sync
> node postinstall
> serverless#1.28.0 postinstall /Users/pro/node_modules/serverless
> node ./scripts/postinstall.js
Error: socket hang up
at createHangUpError (_http_client.js:322:15)
at TLSSocket.socketOnEnd (_http_client.js:425:23)
at TLSSocket.emit (events.js:187:15)
at TLSSocket.EventEmitter.emit (domain.js:442:20)
at endReadableNT (_stream_readable.js:1092:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
npm WARN cognito-backend#1.0.0 No description
npm WARN cognito-backend#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! serverless#1.28.0 postinstall: `node ./scripts/postinstall.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serverless#1.28.0 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:

I found a github issue that solves my problem:
https://github.com/maciejtreder/ng-toolkit/issues/448
use nvm install v10.6.0

Related

Any Idea why vite.js is having issues in react with esbuild

I tried installing react app with vite and after installation when i tried using npm run dev it keeps throwing this error,
dyld: Symbol not found: _clock_gettime
Referenced from: /Users/KELVIN/Desktop/ZZZ/react/mobile_banking/node_modules/#esbuild/darwin-x64/bin/esbuild
Expected in: flat namespace
failed to load config from /Users/KELVIN/Desktop/ZZZ/react/mobile_banking/vite.config.js
error when starting dev server:
Error: The service was stopped
at /Users/KELVIN/Desktop/ZZZ/react/mobile_banking/node_modules/esbuild/lib/main.js:1145:25
at Object.responseCallbacks.<computed> (/Users/KELVIN/Desktop/ZZZ/react/mobile_banking/node_modules/esbuild/lib/main.js:
701:9)
at Socket.afterClose (/Users/KELVIN/Desktop/ZZZ/react/mobile_banking/node_modules/esbuild/lib/main.js:691:28)
at Socket.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1333:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mobile_banking#0.0.0 dev: `vite`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mobile_banking#0.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
please what can i do.
I've tried deleting the package.json and package-lock.json and installing it back using npm install but it still won't work.

error installing firebase `npm install -g firebase-tools`

i am try to use firebase-cloud-messaging with javascipt
and i use this repo : https://github.com/firebase/quickstart-js/tree/master/messaging
in the Get Started i must run this command npm install -g firebase-tools. but i got error like this :
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! protobufjs#6.11.2 postinstall: `node scripts/postinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the protobufjs#6.11.2 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! /root/.npm/_logs/2021-10-28T09_18_46_217Z-debug.log
can anyone help and explain to me what's wrong it this, i have try any solution in google but still error like this.
Thanks
Version node : v14.18.1
Version npm : 6.14.15
OS : Linux Elementary 6
Try to run this:
sudo npm install --unsafe-perm -g firebase-tools
More about the --unsafe-perm can be read here

Error when using npm vue-cli

Windows 10
node v8.9.2
npm 5.5.1
installed vue-cli through the use of npm but entering 'npm run dev' resulted in an error.
this is error message
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! webpack-simple#1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webpack-simple#1.0.0 dev 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\hansol\AppData\Roaming\npm-cache\_logs\2017-12-08T04_14_50_859Z-debug.log
It appears as though you havent installed the node modules / dependencies.
Please try and run a
npm install
And see if that works
I used to face this problem when the port is busy.
So confirm the port you are opening for the dev server.
you can also change the port using a flag "--port 3000".

Angular 2, Node js Error npm run server:prod

I have an error trying to run the project in production,
When running npm run build: prod compiles me without errors, but when running npm run server: prod pass this:
C:\Users\Prueba Tecnica\Venfi> npm run server:prod
> venfi#3.3.0 server:prod C:\Users\Prueba Tecnica\Venfi
> http-server dist --cors
events.js:160
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE 0.0.0.0:8080
at Object.exports._errnoException (util.js:1026:11)
at exports._exceptionWithHostPort (util.js:1049:20)
at Server._listen2 (net.js:1257:14)
at listen (net.js:1293:10)
at net.js:1403:9
at _combinedTickCallback (internal/process/next_tick.js:77:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "server:prod"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! venfi#3.3.0 server:prod: `http-server dist --cors`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the venfi#3.3.0 server:prod script 'http-server dist --cors'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the venfi package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! http-server dist --cors
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs venfi
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls venfi
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Prueba Tecnica\Venfi\npm-debug.log
Thanks for your help.
This is not node JS error,
Something is already running on Port 8080.
Kill that & run this again .!
Steps to kill a process on a port.
Type netstat -a -o -n and it will bring up a network list, look at the PID (e.g. 8080).
2 .To find out what PID 8080 was (hopefully not a trojan) I typed tasklist /FI “PID eq 8080″
To kill it type taskkill /F /PID 2600 [whatever processId i get in above step.]
Port is already in use. Just open your task manager on what ever OS you are on and kill any node processes. When using node stuff from the cli remember to kill the proccess by pressing ctrl + c when its running. Sometimes if you just close the terminal using X button it will close the terminal but leave the process running it the background. If all else fails and you can't get rid of the message just reboot the computer.

Can't install js-bson

I am using Windows 7 64bit, trying to install bson as a dependencie of mongodb.
I get this error:
npm WARN package.json Wochenplaner#0.0.1 No README.md file found!
npm http GET https://registry.npmjs.org/bson
npm http 304 https://registry.npmjs.org/bson
bson#0.1.5 install C:\Users\Administrator\Dropbox\Projekte\Wochenplaner\node_m
odules\bson
node install.js || (exit 0)
CreateProcessW: Das System kann die angegebene Datei nicht finden.
npm ERR! error rolling back Error: ENOTEMPTY, rmdir 'C:\Users\Administrator\Drop
box\Projekte\Wochenplaner\node_modules\bson'
npm ERR! error rolling back bson#0.1.5 { [Error: ENOTEMPTY, rmdir 'C:\Users\Adm
inistrator\Dropbox\Projekte\Wochenplaner\node_modules\bson']
npm ERR! error rolling back errno: 53,
npm ERR! error rolling back code: 'ENOTEMPTY',
npm ERR! error rolling back path: 'C:\Users\Administrator\Dropbox\Projekte
\Wochenplaner\node_modules\bson' }
npm ERR! bson#0.1.5 install: node install.js || (exit 0)
npm ERR! cmd "/c" "node install.js || (exit 0)" failed with 127
npm ERR!
npm ERR! Failed at the bson#0.1.5 install script.
npm ERR! This is most likely a problem with the bson package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js || (exit 0)
npm ERR! You can get their info via:
npm ERR! npm owner ls bson
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7600
npm ERR! command "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nod
ejs\node_modules\npm\bin\npm-cli.js" "install" "bson"
npm ERR! cwd C:\Users\Administrator\Dropbox\Projekte\Wochenplaner
npm ERR! node -v v0.8.16
npm ERR! npm -v 1.1.69
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\Administrator\Dropbox\Projekte\Wochenplaner\npm-debug.log
npm ERR! not ok code 0
I get this log: http://pastebin.com/B6F2C5um
What is the problem?
Also: I tried to install versions 0.1.1, 0.1.2, 0.1.3 etc.
I was having the same exact issue and remembered I had fiddled with my PATH variable, recently. It was failing to run cmd.exe.
It was fixed after adding c:\windows\system32 to my PATH.
Per below (note the node issue mentions socket.io, which was also causing similar problems when I tested it):
https://github.com/joyent/node/issues/4222
Try deleting C:\Users\Administrator\Drop
box\Projekte\Wochenplaner\node_modules and reinstalling.
I just installed the bson package on my Win7 (64bit also) box without any issues.
Check the following points.
Is your node executable accessible from everywhere? (check with opening a command line and just type node + Enter, if a shell pops up you should be fine)
Do you have sufficent access rights for the target folder in question?
Since the main error seems to be CreateProcessW: Das System kann die angegebene Datei nicht finden., i'm pretty sure the first point is the issue.
You could fix that easily by either re-installing node.js or adding the path to your node executable manually to the PATH environment variable.

Categories