{"action":"created","issue":{"url":"https://api.github.com/repos/yarnpkg/yarn/issues/733","repository_url":"https://api.github.com/repos/yarnpkg/yarn","labels_url":"https://api.github.com/repos/yarnpkg/yarn/issues/733/labels{/name}","comments_url":"https://api.github.com/repos/yarnpkg/yarn/issues/733/comments","events_url":"https://api.github.com/repos/yarnpkg/yarn/issues/733/events","html_url":"https://github.com/yarnpkg/yarn/issues/733","id":182369793,"number":733,"title":"yarn run with bin in local node_modules","user":{"login":"billxinli","id":1641464,"avatar_url":"https://avatars.githubusercontent.com/u/1641464?v=3","gravatar_id":"","url":"https://api.github.com/users/billxinli","html_url":"https://github.com/billxinli","followers_url":"https://api.github.com/users/billxinli/followers","following_url":"https://api.github.com/users/billxinli/following{/other_user}","gists_url":"https://api.github.com/users/billxinli/gists{/gist_id}","starred_url":"https://api.github.com/users/billxinli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billxinli/subscriptions","organizations_url":"https://api.github.com/users/billxinli/orgs","repos_url":"https://api.github.com/users/billxinli/repos","events_url":"https://api.github.com/users/billxinli/events{/privacy}","received_events_url":"https://api.github.com/users/billxinli/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yarnpkg/yarn/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"Daniel15","id":91933,"avatar_url":"https://avatars.githubusercontent.com/u/91933?v=3","gravatar_id":"","url":"https://api.github.com/users/Daniel15","html_url":"https://github.com/Daniel15","followers_url":"https://api.github.com/users/Daniel15/followers","following_url":"https://api.github.com/users/Daniel15/following{/other_user}","gists_url":"https://api.github.com/users/Daniel15/gists{/gist_id}","starred_url":"https://api.github.com/users/Daniel15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Daniel15/subscriptions","organizations_url":"https://api.github.com/users/Daniel15/orgs","repos_url":"https://api.github.com/users/Daniel15/repos","events_url":"https://api.github.com/users/Daniel15/events{/privacy}","received_events_url":"https://api.github.com/users/Daniel15/received_events","type":"User","site_admin":false},"assignees":[{"login":"Daniel15","id":91933,"avatar_url":"https://avatars.githubusercontent.com/u/91933?v=3","gravatar_id":"","url":"https://api.github.com/users/Daniel15","html_url":"https://github.com/Daniel15","followers_url":"https://api.github.com/users/Daniel15/followers","following_url":"https://api.github.com/users/Daniel15/following{/other_user}","gists_url":"https://api.github.com/users/Daniel15/gists{/gist_id}","starred_url":"https://api.github.com/users/Daniel15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Daniel15/subscriptions","organizations_url":"https://api.github.com/users/Daniel15/orgs","repos_url":"https://api.github.com/users/Daniel15/repos","events_url":"https://api.github.com/users/Daniel15/events{/privacy}","received_events_url":"https://api.github.com/users/Daniel15/received_events","type":"User","site_admin":false}],"milestone":null,"comments":15,"created_at":"2016-10-11T20:46:12Z","updated_at":"2016-10-12T05:11:30Z","closed_at":null,"body":"<!-- *Before creating an issue please make sure you are using the latest version of yarn.* -->\r\n\r\n**Do you want to request a *feature* or report a *bug*?** \r\nReport a bug\r\n\r\n**What is the current behavior?**\r\nFrom npm with respect to `npm run`: `In addition to the shell's pre-existing PATH, npm run adds node_modules/.bin to the PATH provided to scripts. Any binaries provided by locally-installed dependencies can be used without the node_modules/.bin prefix.`\r\n\r\n**If the current behavior is a bug, please provide the steps to reproduce.**\r\n\r\nAdd additional entry to the `scripts` section of the `package.json` without installing the dependency globally (in this case mocha).\r\n\r\n```\r\n  \"scripts\": {\r\n    \"test-api\": \"mocha test/api\"\r\n  },\r\n```\r\n\r\n**What is the expected behavior?**\r\n\r\nIf I run `npm run test-api` it will resolve `mocha` to the local copy. However `yarn run test-api` will produce:\r\n\r\n```\r\n$ \"mocha test/api\" \r\nsh: 1: mocha test/api: not found\r\n```\r\n\r\n**Please mention your node.js, yarn and operating system version.**\r\nnode: 6.7.0\r\nyarn: 0.15\r\nos: Ubuntu 16.04"},"comment":{"url":"https://api.github.com/repos/yarnpkg/yarn/issues/comments/253120608","html_url":"https://github.com/yarnpkg/yarn/issues/733#issuecomment-253120608","issue_url":"https://api.github.com/repos/yarnpkg/yarn/issues/733","id":253120608,"user":{"login":"calvinl","id":490687,"avatar_url":"https://avatars.githubusercontent.com/u/490687?v=3","gravatar_id":"","url":"https://api.github.com/users/calvinl","html_url":"https://github.com/calvinl","followers_url":"https://api.github.com/users/calvinl/followers","following_url":"https://api.github.com/users/calvinl/following{/other_user}","gists_url":"https://api.github.com/users/calvinl/gists{/gist_id}","starred_url":"https://api.github.com/users/calvinl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calvinl/subscriptions","organizations_url":"https://api.github.com/users/calvinl/orgs","repos_url":"https://api.github.com/users/calvinl/repos","events_url":"https://api.github.com/users/calvinl/events{/privacy}","received_events_url":"https://api.github.com/users/calvinl/received_events","type":"User","site_admin":false},"created_at":"2016-10-12T05:11:30Z","updated_at":"2016-10-12T05:11:30Z","body":"I came across this issue as well, and I did a bit of digging. It looks like [this line](https://github.com/yarnpkg/yarn/blob/master/src/cli/commands/run.js#L64) encases `cmd` in double quotes, eventually sending it to `child.spawn()` [here](https://github.com/yarnpkg/yarn/blob/master/src/util/child.js#L25) with the quotes intact, which causes the error.\r\n\r\nMy test script is as follows:\r\n\r\n```\r\n  \"scripts\": {\r\n    \"start\": \"echo 'start'\"\r\n  }\r\n```\r\n\r\nIn [child.js](https://github.com/yarnpkg/yarn/blob/master/src/util/child.js#L25):\r\n```\r\nconst proc = child.spawn(program, args, opts);\r\nconsole.log('program:', program, 'args:', args);\r\n```\r\n\r\nOutputs:\r\n```\r\nprogram: sh args: [ '-c', '\"echo \\'hello\\'\" ' ]\r\n```\r\n\r\nWhere it should be:\r\n```\r\nprogram: sh args: [ '-c', 'echo \\'hello\\'' ]\r\n```\r\n\r\nRemoving the double quotes in [run.js](https://github.com/yarnpkg/yarn/blob/master/src/cli/commands/run.js#L64) seems to make it work fine."}}
{"actor":{"display_login":"calvinl"}}