np icon indicating copy to clipboard operation
np copied to clipboard

Handle network failures gracefully

Open hemanth opened this issue 9 years ago • 1 comments

Here is the scenario:

$ np major --yolo
 ✔ Prerequisite check
 ✔ Git
 ✔ Bumping version
 ✖ Publishing package
   Pushing tags

Command failed: npm publish
npm ERR! publish Failed PUT undefined
npm ERR! Darwin 15.6.0
npm ERR! argv "/Users/hemanth/.nvm/versions/node/v4.2.1/bin/node" "/Users/hemanth/.nvm/versions/node/v4.2.1/bin/npm" "publish"
npm ERR! node v4.2.1
npm ERR! npm  v2.14.7
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! syscall getaddrinfo

npm ERR! network getaddrinfo ENOTFOUND npm.meow.com npm.meow.com:80
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

I fix the proxy and later when I do a np major --yolo it bumps and publishes.

It would be an overhead but worth the trade off, if we check that the previous version before bump was published or handle such case where it might be a network failure and roll-back?

hemanth avatar Sep 10 '16 05:09 hemanth

check that the previous version before bump was published

This is a nifty idea. I've definitely gotten myself into situations where I bumped the version multiple times before publishing (or before publishing succeeded), by accident.

So if np detected that the existing package.json version was never published, it would skip bumping the version? Wouldn't --yolo disable this?

sholladay avatar Oct 03 '16 14:10 sholladay

Closing due to age. np has since added a rollback feature so these errors aren't so bad anymore

fregante avatar Feb 03 '23 10:02 fregante