Getting [..................] / rollbackFailedOptional: verb npm-session 5d754927a47910d2 on installing from github.
Tried multiple things like cleaning cache, resetting proxy, etc but none of them work.
sudo npm install --save github:saarthak-jain/Blockchainbois-Voting
The log file attached is
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli 'saarthak-jain/Blockchainbois-Voting'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 5d754927a47910d2
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData error for github:saarthak-jain/Blockchainbois-Voting premature close
8 timing stage:rollbackFailedOptional Completed in 0ms
9 timing stage:runTopLevelLifecycles Completed in 7432ms
10 verbose stack Error: premature close
10 verbose stack at PassThrough.onclose (/usr/local/lib/node_modules/npm/node_modules/end-of-stream/index.js:47:67)
10 verbose stack at PassThrough.emit (events.js:201:15)
10 verbose stack at emitCloseNT (internal/streams/destroy.js:68:8)
10 verbose stack at processTicksAndRejections (internal/process/task_queues.js:84:9)
11 verbose cwd /home/saarthak/FrontEnd
12 verbose Linux 4.18.0-18-generic
13 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "saarthak-jain/Blockchainbois-Voting"
14 verbose node v12.2.0
15 verbose npm v6.9.0
16 error premature close
17 verbose exit [ 1, true ]
I had the same situation when trying to install a package from Github with an invalid package.json
file.
The file had an extra comma (,) and because of this I was faced with the same Error: premature close
error.
I'm going to "answer" this in case anyone gets here for the same reason I did.
npm install some/package
will fail with:
npm ERR! premature close
if "some/package" does not actually exist. Check to make sure you have the correct spelling on your package name.
For your entertainment, I was supposed to be using:
composer require some/package
In my case, the package I was trying to install had a dependency on a Git repository that didn't have a package.json defined yet. My solution was to checkin/push the missing package.json.
After running yarn install
I got this error:
error Error parsing JSON at "git://github.com/<xxx>.git/package.json", "Unexpected token } in JSON at position <yyy>".
Turns out I broke the package.json
in <xxx>
, fixing that solved the issue.
So:
yarn install
, it may have a better log.package.json
bugs can cause this.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With