{"action":"created","issue":{"url":"https://api.github.com/repos/sindresorhus/execa/issues/3","labels_url":"https://api.github.com/repos/sindresorhus/execa/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/sindresorhus/execa/issues/3/comments","events_url":"https://api.github.com/repos/sindresorhus/execa/issues/3/events","html_url":"https://github.com/sindresorhus/execa/pull/3","id":124109780,"number":3,"title":"add option to prefer locally installed binaries","user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-12-28T19:20:20Z","updated_at":"2015-12-29T08:50:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sindresorhus/execa/pulls/3","html_url":"https://github.com/sindresorhus/execa/pull/3","diff_url":"https://github.com/sindresorhus/execa/pull/3.diff","patch_url":"https://github.com/sindresorhus/execa/pull/3.patch"},"body":"This enables you to `execa('foo')` if you `$ npm install foo` it.\r\n\r\nSome open questions:\r\n\r\n- Should it be enabled by default? That would really be the nicest solution, but not sure about the consequences and whether there are some downsides I haven't thought of.\r\n- What should the option be named? I would like something better than current. Put your bikeshedding hats on."},"comment":{"url":"https://api.github.com/repos/sindresorhus/execa/issues/comments/167749827","html_url":"https://github.com/sindresorhus/execa/pull/3#issuecomment-167749827","issue_url":"https://api.github.com/repos/sindresorhus/execa/issues/3","id":167749827,"user":{"login":"jamestalmage","id":4082216,"avatar_url":"https://avatars.githubusercontent.com/u/4082216?v=3","gravatar_id":"","url":"https://api.github.com/users/jamestalmage","html_url":"https://github.com/jamestalmage","followers_url":"https://api.github.com/users/jamestalmage/followers","following_url":"https://api.github.com/users/jamestalmage/following{/other_user}","gists_url":"https://api.github.com/users/jamestalmage/gists{/gist_id}","starred_url":"https://api.github.com/users/jamestalmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamestalmage/subscriptions","organizations_url":"https://api.github.com/users/jamestalmage/orgs","repos_url":"https://api.github.com/users/jamestalmage/repos","events_url":"https://api.github.com/users/jamestalmage/events{/privacy}","received_events_url":"https://api.github.com/users/jamestalmage/received_events","type":"User","site_admin":false},"created_at":"2015-12-29T08:50:49Z","updated_at":"2015-12-29T08:50:49Z","body":"> If I'm not mistaken, this is possible with npm@3 because it tries to deduplicate the entire dependency tree (please tell me if I'm wrong :)).\r\n\r\nI can't tell from your description if you are wrong or not, but I do know how npm 3 works. :smile:. \r\n\r\n`npm@3` does try to dedupe, but doesn't take it so far it breaks your semver. Let's say you have two dependencies `A` and `B`, which both specify `ava@^0.6.0`, and a two dependencies `C` and `D` which want `ava@^0.9.0`, and the project itself pins to `ava@0.9.1`, you end up with this tree:\r\n\r\n```\r\nnode_modules/\r\n  A/\r\n    node_modules/\r\n      ava@0.6.1\r\n  B/\r\n    node_modules/\r\n      ava@0.6.1\r\n   C/\r\n     node_modules/\r\n       # no ava here - it got deduped\r\n   D/\r\n     node_modules/\r\n       # no ava here - it got deduped\r\n    ava@0.9.1 # deduped!\r\n```\r\n\r\n`A` and `B` do not get deduped dependencies, because their semver spec is incompatible with what is specified in the base project. `C` does get the deduped version because it is semver compatible. If the base projects did not specify `ava` at all (i.e. it wasn't a direct dependency), then `npm` would pick one to dedupe (how / which one it would pick is not entirely clear to me)."}}