npm / npm

This repository is moving to: https://github.com/npm/cli
http://npm.community
17.53k stars 3.02k forks source link

Premature close on install or update #20824

Open Daveke7 opened 6 years ago

Daveke7 commented 6 years ago

I'm opening this issue because:

What's going wrong?

Whenever i try to install or update NPM into my project folder i get a premature close.

How can the CLI team reproduce the problem?

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch-poll": "npm run watch -- --watch-poll",
        "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
        "prod": "npm run production"
    },
    "devDependencies": {
        "axios": "^0.18.0",
        "cross-env": "^5.0.1",
        "jquery": "^3.1.1",
        "jquery-ui": "^1.12.1",
        "laravel-mix": "^2.1",
        "lodash": "^4.17.10",
        "vue": "^2.1.10"
    },
    "dependencies": {
        "Bootstrap-Form-Builder-V3V4": "https://github.com/tonytan4ever/Bootstrap-Form-Builder-V3V4.git",
        "Buttons": "https://github.com/alexwolfe/Buttons.git",
        "Flot": "https://github.com/flot/flot.git",
        "Jcrop": "https://github.com/tapmodo/Jcrop.git",
        "Loader": "https://github.com/matthiasak/Loader.git",
        "Nestable": "https://github.com/dbushell/Nestable.git",
        "X-editable": "^1.5.1",
        "Yamm": "https://github.com/geedmo/yamm3.git",
        "acc-wizard": "https://github.com/sathomas/acc-wizard.git",
        "air-datepicker": "^2.2.3",
        "animate.css": "^3.6.1",
        "animatechart": "https://github.com/Codicode/flotanimator.git",
        "autogrow": "https://github.com/petkaantonov/jQuery-autogrow",
        "awesome-bootstrap-checkbox": "^1.0.1",
        "backbone": "^1.3.3",
        "blueimp-canvas-to-blob": "^3.14.0",
        "blueimp-file-upload": "^9.20.0",
        "blueimp-gallery-with-desc": "https://github.com/likt0r/Gallery.git",
        "blueimp-load-image": "^2.18.0",
        "blueimp-tmpl": "^3.11.0",
        "bootstrap": "^4.0.0",
        "bootstrap-colorpicker": "^2.5.2",
        "bootstrap-datepicker": "^1.7.1",
        "bootstrap-daterangepicker": "^3.0.3",
        "bootstrap-datetime-picker": "^2.4.4",
        "bootstrap-fileinput": "^4.4.7",
        "bootstrap-form-builder-v4": "https://github.com/tonytan4ever/Bootstrap-Form-Builder-V3V4.git",
        "bootstrap-magnify": "https://github.com/marcaube/bootstrap-magnify.git",
        "bootstrap-markdown": "^2.10.0",
        "bootstrap-maxlength": "^1.6.0",
        "bootstrap-multiselect": "^0.9.13-1",
        "bootstrap-progressbar": "^0.9.0",
        "bootstrap-rating": "^0.0.1",
        "bootstrap-slider": "^10.0.0",
        "bootstrap-star-rating": "^4.0.2",
        "bootstrap-switch": "^3.3.4",
        "bootstrap-tagsinput": "^0.7.1",
        "bootstrap-timepicker": "^0.5.2",
        "bootstrap-touchspin": "^4.2.5",
        "bootstrap3-wysihtml5-bower": "^0.3.1",
        "bootstrapValidator": "https://github.com/nghuuphuoc/bootstrapvalidator.git",
        "bootstrapvalidator": "https://github.com/nghuuphuoc/bootstrapvalidator.git",
        "bower-jquery-easyPieChart": "https://github.com/nicolabortignon/bower-jquery-easyPieChart.git",
        "bower-jvectormap": "https://github.com/tlvince/bower-jvectormap.git",
        "buttons": "^0.1.2",
        "c3": "^0.4.21",
        "card": "^2.4.0",
        "chart.js": "^2.7.1",
        "ckeditor": "^4.8.0",
        "clockface": "https://github.com/jetapps-eu/clockface.git",
        "clockface.js": "https://github.com/jetapps-eu/clockface.git",
        "countup.js": "^1.9.3",
        "d3": "^5.4.0",
        "d3pie": "^0.2.1",
        "datatables": "^1.10.13",
        "datatables.net": "^1.10.16",
        "datatables.net-bs4": "^1.10.16",
        "datatables.net-buttons": "^1.5.1",
        "datatables.net-buttons-bs": "^1.5.1",
        "datatables.net-buttons-bs4": "^1.5.1",
        "datatables.net-colreorder": "^1.4.1",
        "datatables.net-colreorder-bs": "^1.4.1",
        "datatables.net-colreorder-bs4": "^1.4.1",
        "datatables.net-responsive": "^2.2.1",
        "datatables.net-rowreorder": "^1.2.3",
        "datatables.net-rowreorder-bs": "^1.2.3",
        "datatables.net-rowreorder-bs4": "^1.2.3",
        "datatables.net-scroller": "^1.4.4",
        "datatables.net-scroller-bs": "^1.4.4",
        "datatables.net-scroller-bs4": "^1.4.4",
        "desandro-matches-selector": "^2.0.2",
        "devicon": "^2.0.0",
        "dropify": "^0.2.2",
        "dropzone": "^5.3.0",
        "eonasdan-bootstrap-datetimepicker": "^4.17.47",
        "fancybox": "^3.0.1",
        "flatpickr": "^4.3.2",
        "flot-spline": "^0.0.1",
        "flot.tooltip": "https://github.com/krzysu/flot.tooltip.git",
        "flotanimator": "https://github.com/Codicode/flotanimator.git",
        "flotchart": "https://github.com/flot/flot.git",
        "font-awesome": "~4.7.0",
        "form-builder": "0.0.1",
        "fort.js": "https://github.com/idriskhenchil/fort.js.git",
        "full-calendar": "https://github.com/fullcalendar/fullcalendar.git",
        "fullcalendar": "https://github.com/fullcalendar/fullcalendar.git",
        "gmaps": "^0.4.24",
        "gridmanager": "https://github.com/neokoenig/jQuery-gridmanager.git",
        "holderjs": "^2.9.4",
        "hover.css": "^2.2.1",
        "html5sortable": "^0.9.3",
        "iCheck": "https://github.com/fronteed/iCheck.git",
        "inputmask": "^4.0.0",
        "intl-tel-input": "^12.1.9",
        "ion-rangeslider": "^2.2.0",
        "ionicons": "https://github.com/ionic-team/ionicons.git",
        "isotope-layout": "^3.0.5",
        "jQuery-autogrow": "https://github.com/petkaantonov/jQuery-autogrow",
        "jasny-bootstrap": "3.1.3",
        "jquery-advanced-news-ticker": "https://github.com/risq/jquery-advanced-news-ticker.git",
        "jquery-jeditable": "^2.0.0",
        "jquery-knob": "^1.2.11",
        "jquery-mockjax": "^2.3.0",
        "jquery-slimscroll": "^1.3.8",
        "jquery-steps": "~1.1.0",
        "jquery.flot.tooltip": "https://github.com/krzysu/flot.tooltip.git",
        "jquery.newsTicker": "https://github.com/risq/jquery-advanced-news-ticker.git",
        "jquery.spinner": "https://github.com/vsn4ik/jquery.spinner.git",
        "jqvmap": "^1.5.1",
        "js-beautify": "1.7.5",
        "jscharts": "https://github.com/carlcraig/tc-angular-chartjs.git",
        "jstree": "^3.3.5",
        "jtable": "^2.5.0",
        "masonry-layout": "^4.2.1",
        "mega-master": "https://github.com/geedmo/yamm3.git",
        "metismenu": "^2.7.4",
        "microplugin": "^0.0.3",
        "mixitup": "^3.2.2",
        "mocha": "^5.0.1",
        "modernizr": "^3.5.0",
        "moment": "^2.20.1",
        "morris.js": "^0.5.0",
        "nestable-list": "https://github.com/dbushell/Nestable.git",
        "noty": "^3.2.0-beta",
        "npm": "^6.0.1",
        "owlCarousel": "https://github.com/JeroenKnoops/owlfonk-owlcarousel.git",
        "owlfonk-owlcarousel": "https://github.com/JeroenKnoops/owlfonk-owlcarousel.git",
        "pace-progress": "^1.0.2",
        "pdfmake": "^0.1.35",
        "pickadate": "^3.5.6",
        "popper.js": "^1.12.9",
        "postcss-loader": "^2.1.5",
        "rangy-1.3": "https://github.com/noap/rangy-1.3.git",
        "raphael": "^2.2.7",
        "select2": "^4.0.6-rc.1",
        "select2-bootstrap-theme": "^0.1.0-beta.10",
        "selectize": "^0.12.4",
        "sifter": "^0.5.3",
        "simple-line-icons": "^2.4.1",
        "slimmenu": "https://github.com/adnantopal/slimmenu.git",
        "sortablejs": "^1.7.0",
        "sparkline": "^0.2.0",
        "starability": "^2.3.0",
        "summernote": "^0.8.9",
        "sweetalert": "^2.1.0",
        "sweetalert2": "^7.11.0",
        "switchery": "https://github.com/abpetkov/switchery.git",
        "tc-angular-chartjs": "https://github.com/carlcraig/tc-angular-chartjs.git",
        "tinymce": "^4.7.9",
        "toastr": "^2.1.4",
        "transitionize": "^0.0.3",
        "trumbowyg": "^2.9.4",
        "twitter-bootstrap-wizard": "https://github.com/VinceG/twitter-bootstrap-wizard.git",
        "typeahead.js": "^0.11.1",
        "underscore": "^1.8.3",
        "wowjs": "^1.1.3",
        "wysihtml": "^0.6.0-beta1"
    },
    "engines": {
        "yarn": ">= 1.0.0"
    }
}

logs for the error https://gist.github.com/Daveke7/9ac9cb2d68b4a2c0ca2f28bfdc521141

supporting information:

lakefox commented 6 years ago

Is this your package-lock.json file? And if so are you trying to install your app using npm install?

Daveke7 commented 6 years ago

@lakefox yes this is my package.json and i get a premature close when running npm install.

timjklein36 commented 6 years ago

I am having a similar issue.

Running npm install would yield the following error:

npm ERR! premature close

I also had one git dependency in my package.json. Removing it allowed npm install to run without error.

EDIT: I also have control over the git repo I was trying to install and found out there was an error in the version number for the package.json. It contained leading zeroes. Fixing the version number to comply with the semver spec fixed the install issue.

sRaH commented 6 years ago

@Daveke7 Try yarn install. It worked for me with the same package.json

juztin commented 6 years ago

Also getting this exact same issue.

We did have things working with GitHub private repos, but once we moved to GitLab we began getting the npm ERR! premature close.

yarn also fails, with:

Output:

    at ProcessTermError.ExtendableBuiltin (/opt/yarn-v1.7.0/lib/cli.js:243:66)
    at ProcessTermError.MessageError (/opt/yarn-v1.7.0/lib/cli.js:272:123)
    at new ProcessTermError (/opt/yarn-v1.7.0/lib/cli.js:312:113)
    at ChildProcess.<anonymous> (/opt/yarn-v1.7.0/lib/cli.js:30299:17)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:961:16)
    at Socket.stream.socket.on (internal/child_process.js:380:11)
    at Socket.emit (events.js:182:13)
    at Pipe._handle.close [as _onclose] (net.js:595:12)
error Command failed.
Exit code: 1

We can git clone the repos in both GitHub AND GitLab, they just fail when invoking either npm install or yarn install.

...so for us, it seems GitLab specific only when using npm/yarn.

Update

We've done some more testing, and run into the same, or similar issues with:

DanielRuf commented 6 years ago

Same here with https://github.com/chinchang/web-maker/

DanielRuf commented 6 years ago
npm http fetch GET 200 https://registry.npmjs.org/ecc-jsbn 51ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/bcrypt-pbkdf 51ms (from cache)
npm timing stage:rollbackFailedOptional Completed in 1ms
npm timing stage:runTopLevelLifecycles Completed in 16998ms
npm verb stack Error: premature close
npm verb stack     at PassThrough.onclose (C:\Users\Daniel\AppData\Roaming\npm\node_modules\npm\node_modules\mississippi\node_modules\end-of-stream\index.js:47:67)
npm verb stack     at PassThrough.emit (events.js:187:15)
npm verb stack     at emitCloseNT (internal/streams/destroy.js:59:8)
npm verb stack     at process._tickCallback (internal/process/next_tick.js:63:19)
npm verb cwd C:\Users\Daniel\GITHUB\web-maker
npm verb Windows_NT 10.0.17134
npm verb argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Daniel\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "i" "--verbose"
npm verb node v10.2.1
npm verb npm  v6.1.0
npm ERR! premature close
npm verb exit [ 1, true ]
npm timing npm Completed in 18020ms
DanielRuf commented 6 years ago

A node mdoule / dependency was the cause here too, also a GitHub one which does not have a package.json.