Closed gkovacs closed 6 years ago
Actually it seems I can reproduce this issue on Ubuntu 16.04 as well:
sudo npm install -g yarn
sudo yarn global add gulp-cli
And yet gulp is not showing in /usr/bin/ or anywhere on the PATH (whereas running sudo npm install -g gulp-cli
does work as expected, installing the gulp
command at /usr/bin/gulp
).
Unlike in the case of MinGW on Windows, the output of yarn global bin
is correct on Ubuntu /usr/bin
node 7.7.4 yarn 0.21.3 Ubuntu 16.04 LTS (xenial)
I'm getting this on MacOS 10.12.4 (16E195)
$ yarn global bin
/Users/balupton/.nvm/versions/node/v7.7.4/bin
$ ls /Users/balupton/.nvm/versions/node/v7.7.4/bin
node npm yarn yarnpkg
$ echo $PATH
/Users/balupton/Applications/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:/Users/balupton/.nvm/versions/node/v7.7.4/bin:/Users/balupton/.gems/bin:/usr/local/opt/ruby/bin:/Users/balupton/.go/bin:/Users/balupton/bin:/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/Users/balupton/.scripts/commands:./node_modules/.bin:
$ yarn global add npm-check-updates
yarn global v0.21.3
warning No license field
[1/4] π Resolving packages...
[2/4] π Fetching packages...
[3/4] π Linking dependencies...
[4/4] π Building fresh packages...
success Installed "npm-check-updates@2.10.4" with binaries:
- npm-check-updates
- ncu
warning No license field
β¨ Done in 14.81s.
$ ncu -a
-bash: ncu: command not found
$ ls /Users/balupton/.nvm/versions/node/v7.7.4/bin
node npm yarn yarnpkg
$ yarn global ls
yarn global v0.21.3
warning No license field
info "aurelia-cli@0.26.1" has binaries:
- aurelia
- au
info "now@4.5.3" has binaries:
- now
info "npm-check-updates@2.10.4" has binaries:
- npm-check-updates
- ncu
info "slap@0.1.61" has binaries:
- slap
info "surge@0.18.0" has binaries:
- surge
β¨ Done in 10.69s.
Strangely, the yarn global ls
detects the installed packages, so it seems they are being installed somewhere else, that yarn global bin
is lying about.
Okay removing it and adding it again makes it work:
$ yarn global remove npm-check-updates
yarn global v0.21.3
[1/2] Removing module npm-check-updates...
[2/2] Regenerating lockfile and installing missing dependencies...
warning No license field
success Uninstalled packages.
β¨ Done in 31.82s.
$ ls "$(yarn global bin)"
node npm yarn yarnpkg
$ yarn global ls
yarn global v0.21.3
warning No license field
info "aurelia-cli@0.26.1" has binaries:
- aurelia
- au
info "now@4.5.3" has binaries:
- now
info "slap@0.1.61" has binaries:
- slap
info "surge@0.18.0" has binaries:
- surge
β¨ Done in 9.47s.
$ yarn global add npm-check-updates
yarn global v0.21.3
warning No license field
[1/4] π Resolving packages...
[2/4] π Fetching packages...
[3/4] π Linking dependencies...
[4/4] π Building fresh packages...
success Installed "npm-check-updates@2.10.4" with binaries:
- npm-check-updates
- ncu
warning No license field
β¨ Done in 14.34s.
$ ls "$(yarn global bin)"
ncu node npm npm-check-updates yarn yarnpkg
$ ncu -a
Using /Users/balupton/Projects/active/taskgroup/package.json
βΈ¨βββββββββββββββββββΈ© β :
All dependencies match the latest package versions :)
Here's what I'm guessing is the problem.
You install node with nvm like so:
nvm install v7.5.0
npm install -g yarn
yarn global add npm-check-updates
ls "$(yarn global bin)"
Which is fine and dandy, yarn installs npm-check-updates
to the /Users/balupton/.config/yarn/global
folder, and puts the bin inside /Users/balupton/.nvm/versions/node/v7.7.4/bin
However, if you install a new version of node:
nvm install v7.7.4
ls "$(yarn global bin)"
Then /Users/balupton/.nvm/versions/node/v7.7.4/bin
is empty. However /Users/balupton/.config/yarn/global
remains the same.
So when you do a yarn global add ...
it just checks that /Users/balupton/.config/yarn/global
is the same, and never checks /Users/balupton/.nvm/versions/node/v7.7.4/bin
which the files are missing.
Doing a yarn global remove npm-check-updates
removes it from /Users/balupton/.config/yarn/global
such that a yarn global add npm-check-updates
does the /Users/balupton/.config/yarn/global
check, which determines it needs to be properly installed, and adds the /Users/balupton/.nvm/versions/node/v7.7.4/bin
correctly.
It would be nice if yarn global bin
returned /Users/balupton/.config/yarn/bin
or /Users/balupton/.config/yarn/global/.bin
instead
This shouldn't be an issue anymore so closing. Reopen please if you think it is still a problem.
yarn 0.21.3
Do you want to request a feature or report a bug? Bug
What is the current behavior? When I run
yarn global add gulp-cli
on Windows within the Git Bash shell (MinGW), it doesn't install the command. I looked into the reason and it seems it isn't detecting that it's running within MinGW. So the path it should be installing to is/c/Users/geza/AppData/Roaming/npm
but the output ofyarn global bin
isC:\Program Files\nodejs
If the current behavior is a bug, please provide the steps to reproduce.
This is on a fresh install of Windows 10 Enterprise, 64-bit
1) install nodejs (I installed the latest version, 7.7.4). go with the default options (ie, let it install nodejs to the windows PATH) 2) install git for for windows from https://git-for-windows.github.io/ (I installed the latest version, 2.12.1). again, go with the default options (ie, let it install git to the windows PATH). 3) reboot windows so we have git and node in our PATH 4) open the Git Bash shell 5) run
npm install -g yarn
to install yarn 6) runyarn global add gulp-cli
7) rungulp
The
gulp
command is not found. if we check/c/Users/geza/AppData/Roaming/npm
then there is no file namedgulp
thereif we instead run
npm install -g gulp-cli
then thegulp
binary shows up at/c/Users/geza/AppData/Roaming/npm
and gulp works.What is the expected behavior? I expect
yarn global add gulp-cli
to have the same behavior within MinGW asnpm install -g gulp-cli
- ie, after running then thegulp
binary is added to/c/Users/geza/AppData/Roaming/npm
Please mention your node.js, yarn and operating system version. node 7.7.4 yarn 0.21.3 windows 10 education, 64-bit, version 1607, OS build 14393.953 git for windows 2.12.1
Here's my PATH within Git Bash: