Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When trying to add a package with a non-existing version the output is the dump of string with all possible versions, concatenated with "\n"
$ yarn add webpack@2
yarn add v0.17.10
[1/4] 馃攳 Resolving packages...
error Couldn't find any versions for "webpack" that matches "2". Possible versions: "0.1.0\n0.1.1\n0.1.2\n0.1.3\n0.1.4\n0.1.5\n0.1.6\n0.2.0\n0.2.1\n0.2.2\n0.2.3\n0.2.4\n0.2.6\n0.2.7\n0.2.8\n0.3.0\n0.3.1\n0.3.2\n0.3.3\n0.3.4\n0.3.6\n0.3.7\n0.3.8\n0.3.9\n0.3.10\n0.3.11\n0.3.12\n0.3.13\n0.3.14\n0.3.15\n0.3.16\n0.3.17\n0.3.18\n0.3.19\n0.3.20\n0.4.0\n0.4.1\n0.4.2\n0.4.3\n0.4.4\n0.4.5\n0.4.6\n0.4.7\n0.4.8\n0.4.9\n0.4.10\n0.4.11\n0.4.12\n0.4.13\n0.4.14\n0.4.15\n0.4.16\n0.4.17\n0.4.18\n0.4.19\n0.4.20\n0.4.21\n0.4.23\n0.4.24\n0.4.25\n0.5.0\n0.5.1\n0.5.2\n0.5.3\n0.5.4\n0.5.5\n0.5.6\n0.5.7\n0.5.8\n0.5.10\n0.6.0\n0.6.1\n0.6.2\n0.7.0-beta\n0.7.0-beta2\n0.7.0-beta3\n0.7.0-beta4\n0.7.0-beta5\n0.7.0-beta6\n0.7.0-beta7\n0.7.0-beta8\n0.7.0\n0.7.1\n0.7.2\n0.7.3\n0.7.4\n0.7.5\n0.7.6\n0.7.7\n0.7.8\n0.7.9\n0.7.11\n0.7.12\n0.7.13\n0.7.14\n0.7.15\n0.7.16\n0.7.17\n0.8.0-beta1\n0.8.0-beta2\n0.8.0-beta3\n0.8.0-beta4\n0.8.0\n0.8.2\n0.8.3\n0.9.0-beta1\n0.9.0-beta2\n0.9.0-beta4\n0.9.0-beta5\n0.9.0-beta6\n0.9.0-beta7\n0.9.0-beta8\n0.9.0-beta9\n0.9.0-beta10\n0.9.0-beta11\n0.9.0-beta12\n0.9.0-beta13\n0.9.0-beta14\n0.9.0-beta15\n0.9.0-beta16\n0.9.0-beta17\n0.9.0-beta18\n0.9.0-beta19\n0.9.0-beta20\n0.9.0-beta21\n0.9.0-beta22\n0.9.0-beta23\n0.9.0-beta24\n0.9.0-beta25\n0.9.0-beta26\n0.9.0-beta27\n0.9.0-beta28\n0.9.0-beta29\n0.9.0-beta30\n0.9.0-beta31\n0.9.0-beta32\n0.9.0-beta33\n0.9.0-beta34\n0.9.0-beta35\n0.9.0-beta36\n0.9.0-beta37\n0.9.0-beta38\n0.9.0\n0.9.1\n0.9.2\n0.9.3\n0.10.0-beta2\n0.10.0-beta3\n0.10.0-beta5\n0.10.0-beta6\n0.10.0-beta7\n0.10.0-beta8\n0.10.0-beta9\n0.10.0-beta10\n0.10.0-beta11\n0.10.0-beta12\n0.10.0-beta13\n0.10.0-beta14\n0.10.0-beta15\n0.10.0-beta16\n0.10.0-beta17\n0.10.0-beta18\n0.10.0-beta19\n0.10.0-beta20\n0.10.0-beta21\n0.10.0-beta22\n0.10.0-beta23\n0.10.0-beta24\n0.10.0-beta25\n0.10.0\n0.11.0-beta1\n0.11.0-beta2\n0.11.0-beta3\n0.11.0-beta4\n0.11.0-beta5\n0.11.0-beta6\n0.11.0-beta7\n0.11.0-beta8\n0.11.0-beta9\n0.11.0-beta10\n0.11.0-beta11\n0.11.0-beta12\n0.11.0-beta13\n0.11.0-beta14\n0.11.0-beta15\n0.11.0-beta16\n0.11.0-beta17\n0.11.0-beta18\n0.11.0-beta19\n0.11.0-beta20\n0.11.0-beta21\n0.11.0-beta22\n0.11.0-beta23\n0.11.0-beta24\n0.11.0-beta25\n0.11.0-beta26\n0.11.0-beta27\n0.11.0-beta28\n0.11.0-beta29\n0.11.0\n0.11.1\n0.11.2\n0.11.3\n0.11.4\n0.11.5\n0.11.6\n0.11.7\n0.11.8\n0.11.9\n0.11.10\n0.11.11\n0.11.12\n0.11.13\n0.11.14\n0.11.15\n1.0.0-beta1\n1.0.0-beta2\n1.0.0-beta3\n1.0.0-beta4\n0.11.16\n0.11.17\n0.11.18\n1.0.0-beta5\n1.0.0-beta6\n1.0.0-beta7\n1.0.0-beta8\n1.0.0-beta9\n1.0.0-rc1\n1.0.0-rc2\n1.0.0-rc3\n1.0.0-rc4\n1.0.0-rc5\n1.0.0-rc7\n1.0.0-rc8\n1.0.0-rc9\n1.0.0-rc11\n1.0.0-rc12\n1.0.0\n1.0.1\n1.0.3\n1.0.4\n1.0.5\n1.1.0-beta1\n1.1.0-beta2\n1.1.0-beta3\n1.1.0-beta4\n1.1.0-beta5\n1.1.0-beta6\n1.1.0-beta7\n1.1.0-beta8\n1.1.0-beta9\n1.1.0-beta10\n1.1.0-beta12\n1.1.0\n1.1.1\n1.1.2\n1.1.3\n1.1.4\n1.1.5\n1.1.6\n1.1.7\n1.1.8\n1.1.9\n1.1.10\n1.1.11\n1.2.0-beta1\n1.2.0-beta2\n1.2.0-beta4\n1.2.0-beta5\n1.2.0-beta6\n1.3.0-beta1\n1.3.0-beta2\n1.3.0-beta3\n1.3.0-beta4\n1.3.0-beta5\n1.3.0-beta6\n1.3.0-beta7\n1.3.0-beta8\n1.3.0-beta9\n1.3.1-beta1\n1.3.1-beta2\n1.3.1-beta3\n1.3.1-beta4\n1.3.1-beta5\n1.3.1-beta6\n1.3.1-beta7\n1.3.1-beta8\n1.3.1-beta9\n1.3.2-beta1\n1.3.2-beta2\n1.3.2-beta3\n1.3.2-beta4\n1.3.2-beta5\n1.3.2-beta6\n1.3.2-beta7\n1.3.2-beta8\n1.3.2-beta9\n1.3.3-beta1\n1.3.3-beta2\n1.3.4\n1.3.5\n1.3.6\n1.3.7\n1.4.0-beta1\n1.4.0-beta2\n1.4.0-beta3\n1.4.0-beta4\n1.4.0-beta5\n1.4.0-beta6\n1.4.0-beta7\n1.4.0-beta8\n1.4.0-beta9\n1.4.0-beta10\n1.4.1-beta1\n1.4.2\n1.4.3\n1.4.4\n1.4.5\n1.4.6\n1.4.7\n1.4.8\n1.4.9\n1.4.10\n1.4.11\n1.4.12\n1.4.13\n1.4.14\n1.4.15\n1.5.0\n1.5.1\n1.5.2\n1.5.3\n1.6.0\n1.7.0\n1.7.1\n1.7.2\n1.7.3\n1.8.0\n1.8.1\n1.8.2\n1.8.3\n1.8.4\n1.8.5\n1.8.6\n1.8.7\n1.8.8\n1.8.9\n1.8.10\n1.8.11\n1.9.0\n1.9.1\n1.9.2\n1.9.3\n1.9.4\n1.9.5\n1.9.6\n1.9.7\n1.9.8\n1.9.9\n1.9.10\n1.9.11\n1.9.12\n1.9.13\n1.10.0\n1.10.1\n1.10.2\n1.10.3\n1.10.4\n1.10.5\n1.11.0\n1.12.0\n1.12.1\n1.12.2\n2.0.0-beta\n1.12.3\n1.12.4\n1.12.5\n1.12.6\n1.12.7\n1.12.8\n1.12.9\n2.0.1-beta\n2.0.2-beta\n1.12.10\n1.12.11\n2.0.4-beta\n1.12.12\n2.0.5-beta\n2.0.6-beta\n2.0.7-beta\n1.12.13\n2.1.0-beta.0\n2.1.0-beta.1\n2.1.0-beta.2\n1.12.14\n2.1.0-beta.3\n2.1.0-beta.4\n2.1.0-beta.5\n1.12.15\n1.13.0\n2.1.0-beta.6\n2.1.0-beta.7\n1.13.1\n2.1.0-beta.8\n2.1.0-beta.9\n2.1.0-beta.10\n2.1.0-beta.11\n2.1.0-beta.12\n2.1.0-beta.13\n2.1.0-beta.14\n2.1.0-beta.15\n2.1.0-beta.16\n2.1.0-beta.17\n2.1.0-beta.18\n2.1.0-beta.19\n2.1.0-beta.20\n2.1.0-beta.21\n1.13.2\n2.1.0-beta.22\n2.1.0-beta.23\n2.1.0-beta.24\n2.1.0-beta.25\n1.13.3\n2.1.0-beta.26\n2.1.0-beta.27"
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

What is the expected behavior?
Each version should be visually printed in a new line.
Please mention your node.js, yarn and operating system version.
I did some digging in the code and the issue seems related to the JSON.stringify() in the base-reporter. I guess this is convenient to automatically wrap in quotes the placeholder values for the error messages, but when the errors contains newlines it doesn't look nice.
The code generating this error lives in https://github.com/yarnpkg/yarn/blob/6505d52ff4d4eb9b811bbb00c50af06ee7ac4b44/src/resolvers/registries/npm-resolver.js#L42-L46. If we don't necessarily need each package version in it's own line a quick solution could be to just remove the ternary operator in there and leave it as versions.join(', ').
I took the liberty of opening a pull request (see above) that does this exactly. If one of the maintainers thinks there's a better option I'm happy to help :)
Tangentially, it would be awesome to have a UI to interactively select a valid version to install, similar to the upgrade-interactive feature that @torifat added. If the version is invalid, we could show the list and let the user select a version.
@Daniel15 nice Idea 馃槃 I can work on a PR.
But, This one will be a few pages long 馃槢
Looks to be same as #2114
@olingern not duplicate, similar though. One is incompatible dependency, another is wrong dependency.
@torifat Indeed the issues are different, but the EOL output issues seem to be the same. So, fixing EOL issues should resolve both.
@torifat Your interactive upgrade would fix this issue and improve, though. 馃挭
This should do, I think:

@Daniel15 Any suggestion?
@torifat Maybe this is getting ahead of ourselves, but it would be awesome if it attempted to filter. So, as @afgomez attempted to yarn add webpack@2, if it only showed all minor / patches under major version 2 - I think that might be nice.
Took a stab at this. Please lmk if I missed anything.
Most helpful comment
This should do, I think:

@Daniel15 Any suggestion?