{"action":"created","issue":{"url":"https://api.github.com/repos/yarnpkg/yarn/issues/2466","repository_url":"https://api.github.com/repos/yarnpkg/yarn","labels_url":"https://api.github.com/repos/yarnpkg/yarn/issues/2466/labels{/name}","comments_url":"https://api.github.com/repos/yarnpkg/yarn/issues/2466/comments","events_url":"https://api.github.com/repos/yarnpkg/yarn/issues/2466/events","html_url":"https://github.com/yarnpkg/yarn/issues/2466","id":201053994,"number":2466,"title":"`yarn add` with non-existent version saves wrong version to package.json","user":{"login":"bestander","id":2121048,"avatar_url":"https://avatars.githubusercontent.com/u/2121048?v=3","gravatar_id":"","url":"https://api.github.com/users/bestander","html_url":"https://github.com/bestander","followers_url":"https://api.github.com/users/bestander/followers","following_url":"https://api.github.com/users/bestander/following{/other_user}","gists_url":"https://api.github.com/users/bestander/gists{/gist_id}","starred_url":"https://api.github.com/users/bestander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bestander/subscriptions","organizations_url":"https://api.github.com/users/bestander/orgs","repos_url":"https://api.github.com/users/bestander/repos","events_url":"https://api.github.com/users/bestander/events{/privacy}","received_events_url":"https://api.github.com/users/bestander/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-01-16T15:49:38Z","updated_at":"2017-01-17T17:25:59Z","closed_at":null,"body":"\r\n**Do you want to request a *feature* or report a *bug*?**\r\nBUG\r\n**What is the current behavior?**\r\n\r\n```\r\n$ ../yarn/bin/yarn add is-array@100\r\nyarn add v0.20.0-0\r\ninfo No lockfile found.\r\n[1/4] 🔍  Resolving packages...\r\nCouldn't find any versions for \"is-array\" that matches \"100\"\r\n? Please choose a version from this list: 1.0.1\r\n[2/4] 🚚  Fetching packages...\r\n[3/4] 🔗  Linking dependencies...\r\n[4/4] 📃  Building fresh packages...\r\nsuccess Saved lockfile.\r\nsuccess Saved 1 new dependency.\r\n└─ is-array@1.0.1\r\n✨  Done in 2.80s.\r\n$ ls\r\nnode_modules\tpackage.json\tyarn.lock\r\n$ cat package.json\r\n{\r\n  \"dependencies\": {\r\n    \"is-array\": \"100\"\r\n  }\r\n}\r\n$ cat yarn.lock\r\n# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\r\n# yarn lockfile v1\r\n\r\n\r\nis-array@100:\r\n  version \"1.0.1\"\r\n  resolved \"https://registry.yarnpkg.com/is-array/-/is-array-1.0.1.tgz#e9850cc2cc860c3bc0977e84ccf0dd464584279a\"\r\n```\r\n\r\nThe node_modules is correct but package.json and yarn.lock have the incorrect version.\r\n\r\n\r\n\r\n**Please mention your node.js, yarn and operating system version.**\r\n0.19 branch cut"},"comment":{"url":"https://api.github.com/repos/yarnpkg/yarn/issues/comments/273237382","html_url":"https://github.com/yarnpkg/yarn/issues/2466#issuecomment-273237382","issue_url":"https://api.github.com/repos/yarnpkg/yarn/issues/2466","id":273237382,"user":{"login":"warpy","id":127897,"avatar_url":"https://avatars.githubusercontent.com/u/127897?v=3","gravatar_id":"","url":"https://api.github.com/users/warpy","html_url":"https://github.com/warpy","followers_url":"https://api.github.com/users/warpy/followers","following_url":"https://api.github.com/users/warpy/following{/other_user}","gists_url":"https://api.github.com/users/warpy/gists{/gist_id}","starred_url":"https://api.github.com/users/warpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/warpy/subscriptions","organizations_url":"https://api.github.com/users/warpy/orgs","repos_url":"https://api.github.com/users/warpy/repos","events_url":"https://api.github.com/users/warpy/events{/privacy}","received_events_url":"https://api.github.com/users/warpy/received_events","type":"User","site_admin":false},"created_at":"2017-01-17T17:25:59Z","updated_at":"2017-01-17T17:25:59Z","body":"It looks like the `savePackages` step in Add uses the same pattern that was originally requested by the user (see https://github.com/yarnpkg/yarn/blob/edd1a07968d8d2e526d0c5ca00fd18ef80b553b3/src/cli/commands/add.js#L66) We would need to update this logic to make it smarter by checking the actually resolved version.\r\n\r\nI still need to see where the pattern gets saved to the manifest for the Install command, but we'd have to make it happen there too."}}
{"actor":{"display_login":"warpy"}}