yarn global bin has difficulties with ~ in path

Created on 9 Mar 2017  ·  3Comments  ·  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?

BUG

What is the current behavior?

If the global prefix is set to a path contain a tilde-character yarn global bin seems to treat it as dot-character, i.e. a relative path.

If the current behavior is a bug, please provide the steps to reproduce.

$ yarn config list
info npm config
{ prefix: '~/.npm-global' }
$ pwd
/Users/creynders/foo/bar/qux
$ yarn global bin
/Users/creynders/foo/bar/qux/~/.npm-global/bin

What is the expected behavior?

$ yarn config list
info npm config
{ prefix: '~/.npm-global' }
$ pwd
/Users/creynders/foo/bar/qux
$ yarn global bin
/Users/creynders/.npm-global/bin

Please mention your node.js, yarn and operating system version.

node: v6.9.5
yarn: 0.20.3
OS: OS X 10.12.3

Temporary fix
Use an absolute path for your prefix

$ npm config set prefix /Users/creynder/.npm-global
cat-bug good first issue triaged

All 3 comments

Just ran into this. When you notice the errantly created local ~ folder, the temptation is to try deleting it, which you have to be very careful about...

I confirm this bug, this not only make it unusable but it create a false ~ folder. I was also tempted to enter rm -r ~ before taking me back ^^'

Fixed by #3576.

Was this page helpful?
0 / 5 - 0 ratings