JamieMason / shrinkpack

Fast, resilient, reproducible builds with npm install.
https://www.npmjs.com/package/shrinkpack
MIT License
793 stars 38 forks source link

UnhandledPromiseRejectionWarning: Unhandled promise rejection #88

Closed viewhao closed 6 years ago

viewhao commented 6 years ago

when i follow the tutorial, i encounter this error

shrinkpack-demo viewhao$ shrinkpack .
(node:85988) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Command failed: npm cache ls
npm ERR! Usage: npm cache add <tarball file>
npm ERR! npm cache add <folder>
npm ERR! npm cache add <tarball url>
npm ERR! npm cache add <git url>
npm ERR! npm cache add <name>@<version>
npm ERR! npm cache clean
npm ERR! npm cache verify

(node:85988) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
! Please raise an issue at https://github.com/JamieMason/shrinkpack/issues

    Error: ! failed to read contents of npm cache
        at ChildProcess.onClose (/usr/local/lib/node_modules/shrinkpack/src/analyse/read-npm-cache.js:40:25)
        at emitTwo (events.js:125:13)
        at ChildProcess.emit (events.js:213:7)
        at maybeClose (internal/child_process.js:897:16)
        at Socket.stream.socket.on (internal/child_process.js:340:11)
        at emitOne (events.js:115:13)
        at Socket.emit (events.js:210:7)
        at Pipe._handle.close [as _onclose] (net.js:548:12)

my node version is v8.1.2

valscion commented 6 years ago

Hi! Could you tell what npm --version tells you?

viewhao commented 6 years ago

my npm version is: 5.5.1

valscion commented 6 years ago

Ok. Unfortunately shrinkpack does not yet support npm5. You might want to subscribe to issue #83 to get notified if the situation changes.

viewhao commented 6 years ago

Thank you @valscion

JamieMason commented 6 years ago

Thanks @valscion for picking this up, huge help :+1: I will close this @viewhao to be tracked by #83 (which is only a week or so away by the look of things).

valscion commented 6 years ago

Happy to help! You're doing great job :+1:

anasyo10 commented 5 years ago

I am getting the same error on npm 6.9.0, what should I do ?