Skip to content

Commit af72e6a

Browse files
Hidde Boomsmaarcanis
authored andcommitted
Support Darwin bash in bin/yarn (#6568)
* Support Darwin bash in bin/yarn If the yarn binary is a symlink the `basepath` is not correctly resolved on OSX/Darwin. For example take the following structure: ``` vendor/yarnpkg/yarn vendor/bin/yarn -> ../yarnpkg/yarn/bin/yarn ``` And run yarn: ``` $ yarn internal/modules/cjs/loader.js:582 throw err; ^ Error: Cannot find module '/Users/yarnpkg/yarn/bin/yarn.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15) at Function.Module._load (internal/modules/cjs/loader.js:506:25) at Function.Module.runMain (internal/modules/cjs/loader.js:741:12) at startup (internal/bootstrap/node.js:285:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3) ``` Since the symlink is not resolved the relative path in the symlink leads to the wrong path. This PR, fixes that issue. * Update CHANGELOG.md
1 parent f6d0a5b commit af72e6a

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ Please add one entry in this file for each change in Yarn's behavior. Use the sa
4040

4141
[#6562](https://github.com/yarnpkg/yarn/pull/6562) - [**Bertrand Marron**](https://github.com/tusbar)
4242

43+
- Fixes Yarn invocations on Darwin when the `yarn` binary was symlinked
44+
45+
[#6568](https://github.com/yarnpkg/yarn/pull/6568) - [**Hidde Boomsma**](https://github.com/hboomsma)
46+
4347
- Fixes `require.resolve` when used together with the `paths` option
4448

4549
[#6565](https://github.com/yarnpkg/yarn/pull/6565) - [**Maël Nison**](https://twitter.com/arcanis)

bin/yarn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ argv0=$(echo "$0" | sed -e 's,\\,/,g')
33
basedir=$(dirname "$(readlink "$0" || echo "$argv0")")
44

55
case "$(uname -s)" in
6+
Darwin) basedir="$( cd "$( dirname "$argv0" )" && pwd )";;
67
Linux) basedir=$(dirname "$(readlink -f "$0" || echo "$argv0")");;
78
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
89
*MSYS*) basedir=`cygpath -w "$basedir"`;;

0 commit comments

Comments
 (0)