See all versions available of a npm package

To see in a pretty way all the available versions of any npm package.

$ npm view {package_name} versions --json

Example

$ npm view webpack versions --json

Write the output into a json file.

$ npm view @babel/core versions --json > babel_core_versions.json