New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

global binaries don't install on mac os sierra #1321

Closed
selfagency opened this Issue Oct 20, 2016 · 36 comments

Comments

Projects
None yet
@selfagency

selfagency commented Oct 20, 2016

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

What is the current behavior?
installing global packages does not appear to work.

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

» yarn global add cleanup-dependencies html-validator-cli jspm node-inspector bower css-lint grunt grunt-cli gulp html-validator-cli mjml nativefier node-sass nodemon svg-sprite svgo tldr wring pubstorm pug-lint npm-check-updates
yarn global v0.16.0
warning No license field
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
success Installed cleanup-dependencies@0.0.6 with binaries:
      - clean-deps
success Installed html-validator-cli@3.0.2 with binaries:
      - html-validator
success Installed jspm@0.16.46 with binaries:
      - jspm
success Installed node-inspector@0.12.8 with binaries:
      - node-inspector
      - node-debug
success Installed bower@1.7.9 with binaries:
      - bower
success Installed css-lint@1.0.1 with binaries:
      - sass-lint
success Installed grunt@1.0.1 with binaries:
      - grunt
success Installed grunt-cli@1.2.0 with binaries:
      - grunt
success Installed gulp@3.9.1 with binaries:
      - gulp
success Installed html-validator-cli@3.0.2 with binaries:
      - html-validator
success Installed mjml@3.0.0 with binaries:
      - mjml
success Installed nativefier@7.0.1 with binaries:
      - nativefier
success Installed node-sass@3.10.1 with binaries:
      - node-sass
success Installed nodemon@1.11.0 with binaries:
      - nodemon
success Installed svg-sprite@1.3.6 with binaries:
      - svg-sprite
success Installed svgo@0.7.1 with binaries:
      - svgo
success Installed tldr@1.6.2 with binaries:
      - tldr
success Installed wring@1.0.0 with binaries:
      - wring
success Installed pubstorm@0.3.2 with binaries:
      - storm
success Installed pug-lint@2.3.0 with binaries:
      - pug-lint
success Installed npm-check-updates@2.8.5 with binaries:
      - npm-check-updates
      - ncu
✨  Done in 13.38s.
» yarn bin
/Users/ds/node_modules/.bin

» ls -la ~/node_modules
ls: /Users/ds/node_modules: No such file or directory
» yarn global ls
yarn global v0.16.0
warning No license field
info bower@1.7.9 has binaries:
   - bower
info cleanup-dependencies@0.0.6 has binaries:
   - clean-deps
info css-lint@1.0.1 has binaries:
   - sass-lint
info grunt@1.0.1 has binaries:
   - grunt
info grunt-cli@1.2.0 has binaries:
   - grunt
info gulp@3.9.1 has binaries:
   - gulp
info html-validator-cli@3.0.2 has binaries:
   - html-validator
info jspm@0.16.46 has binaries:
   - jspm
info mjml@3.0.0 has binaries:
   - mjml
info nativefier@7.0.1 has binaries:
   - nativefier
info node-inspector@0.12.8 has binaries:
   - node-inspector
   - node-debug
info node-sass@3.10.1 has binaries:
   - node-sass
info nodemon@1.11.0 has binaries:
   - nodemon
info npm-check-updates@2.8.5 has binaries:
   - npm-check-updates
   - ncu
info pubstorm@0.3.2 has binaries:
   - storm
info pug-lint@2.3.0 has binaries:
   - pug-lint
info svg-sprite@1.3.6 has binaries:
   - svg-sprite
info svgo@0.7.1 has binaries:
   - svgo
info tldr@1.6.2 has binaries:
   - tldr
info wring@1.0.0 has binaries:
   - wring
✨  Done in 8.32s.
ds at selfagency-macpro in ~
» bower
fish: Unknown command 'bower'
ds at selfagency-macpro in ~
» gulp
fish: Unknown command 'gulp'
ds at selfagency-macpro in ~
» grunt
fish: Unknown command 'grunt'

What is the expected behavior?
the binaries should be executable.

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

» node -v
v6.8.1

» yarn --version
0.16.0

» sw_vers -productVersion
10.12.1
@smoothdvd

This comment has been minimized.

smoothdvd commented Oct 21, 2016

same problem. 0.16.x is buggy

@timche

This comment has been minimized.

timche commented Oct 21, 2016

Same here:

~ yarn global ls
yarn global v0.16.0
warning No license field
info cat-names@1.0.2 has binaries:
   - cat-names
✨  Done in 0.90s.
➜  ~ cat-names
zsh: command not found: cat-names

But my bin folder is somewhere else:

➜  ~ yarn global bin
/usr/local/Cellar/node/6.9.1/bin

That looks really strange. I've installed Yarn via brew. Also the installation guide says, the bin should be actually $HOME/.yarn/bin.

Btw, why doesn't Yarn use /usr/local/bin like npm?

@jonknapp

This comment has been minimized.

jonknapp commented Oct 22, 2016

I got global bins working by altering my path from what the docs say in the alternative installation section from export PATH="$PATH:$HOME/.yarn/bin" to export PATH="$PATH:$HOME/.yarn/bin:$HOME/.yarn-config/global/node_modules/.bin".

I use nvm with yarn installed through npm as a global package.

@zerovox

This comment has been minimized.

zerovox commented Oct 26, 2016

I had similar issues - I fixed them with export PATH="$PATH:$(yarn global bin)"

@sharat

This comment has been minimized.

sharat commented Nov 5, 2016

Packages are not installed under $HOME/.yarn/bin folder. This breaks the instructions given in the documentation

$ yarn global bin
/usr/local/Cellar/node/7.0.0/bin
@teehemkay

This comment has been minimized.

teehemkay commented Nov 14, 2016

Same issue here (Mac OS X Yosemite 10.10.5, Node 7.1.0, , Yarn 0.16.1 installed via brew):

$ yarn global bin
/usr/local/Cellar/node/7.1.0/bin

This is a also a problem because the path is specific to the version of node used to install globally

@kylecordes

This comment has been minimized.

kylecordes commented Nov 16, 2016

I encountered this trouble on another platform (Ubuntu), in which yarn global ad did not set things up correctly on the path. I see above that @teehemkay installed via brew. I encountered the problem what I had installed yarn using NPM, which is listed as one of the acceptable ways to install it in the documentation. When I installed using its curl-bash installer (wincing at the security, and working in an isolated testing environment), the problem evaporated and global paths worked the first time. It is possible that the problem in this issue is another variation, I would not find this surprising at all because there are so many different ways to install both yarn and node.

@DavidBabel

This comment has been minimized.

DavidBabel commented Nov 16, 2016

Same problem here, it's very anoying :

  ~
 ➜  sw_vers
ProductName:    Mac OS X
ProductVersion: 10.12.1
BuildVersion:   16B2555

  ~
 ➜  brew install node yarn
Warning: node-7.1.0 already installed
Warning: yarn-0.17.2 already installed

  ~
 ➜  yarn global bin
/usr/local/Cellar/node/7.1.0/bin

  ~
 ➜  yarn global ls
yarn global v0.17.2
✨  Done in 0.05s.

  ~
 ➜  yarn global add yarn-completions
yarn global v0.17.2
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
success Installed yarn-completions@0.0.5 with binaries:
      - completions-yarn
✨  Done in 7.75s.

  ~
 ➜  yarn global ls
yarn global v0.17.2
warning No license field
info yarn-completions@0.0.5 has binaries:
   - completions-yarn
✨  Done in 1.08s.

  ~
 ➜  completions-yarn
zsh: command not found: completions-yarn

  ~
 ➜  ls $(yarn global bin)
node

  ~
 ➜  ls ~/.yarn/bin/
ls: /Users/david/.yarn/bin/: No such file or directory

  ~
 ➜  find ~ -name yarn-completions
/Users/david/.config/yarn/global/node_modules/yarn-completions

so i can't add "/Users/david/.config/yarn/global/node_modules/" to my $PATH, cause the problem is this directory is a complete trash with all node modules dependancies.

@gekorob

This comment has been minimized.

gekorob commented Nov 16, 2016

I solved installing yarn@0.16.1 (the same version coming from the bash installer) via npm global.
Everything works now with the node 7.1.0 installed via nvm and yarn@0.16.1.
With the latest 0.17.2 the global install doesn't work for me.

@DavidBabel

This comment has been minimized.

DavidBabel commented Nov 16, 2016

@gekorob thanks for the tips

@gekorob

This comment has been minimized.

gekorob commented Nov 24, 2016

mac osx sierra
node@7.2.0 installed via nvm
yarn@0.17.8 installed via npm -g

I'm facing the same problem with "global add" like in the 0.17.2 (e.g. yarn global add angular-cli doesn't install ng command).
Downgrading to yarn@0.16.1 everything works again

@gekorob

This comment has been minimized.

gekorob commented Nov 25, 2016

Ok solved applying the correct path to my ~/.bash_profile as written in yarn documentation.
I apologise for the previous comment but now everything works with the yarn@0.17.9

@rtfpessoa

This comment has been minimized.

Contributor

rtfpessoa commented Dec 17, 2016

I have similar issues on Ubuntu and Mac OS.

Yarn was installed through apt-get on Ubuntu and Homebrew in Mac OS, and I am using nodenv in both OSs.

yarn global bin returns $HOME/.nodenv/versions/7.2.1/bin which only contains node and npm.

But the binaries are actually in $HOME/.config/yarn/global/node_modules/.bin.

The solutions here do not seem to fix the problem, except for adding $HOME/.config/yarn/global/node_modules/.bin to the PATH which seems rather hackish.

Any suggestions?

@iddan

This comment has been minimized.

iddan commented Jan 30, 2017

same here

@selfagency

This comment has been minimized.

selfagency commented Feb 8, 2017

this works for me as of v0.19.1

@broven

This comment has been minimized.

broven commented Feb 20, 2017

not work for me
Is global modules really install in yarn global bin? I enter and only node in there

$ cd $(yarn global bin) && ls -a
.    ..   node
@eddyerburgh

This comment has been minimized.

eddyerburgh commented Feb 20, 2017

It wasn't working for me when using NVM because I had accidentally removed NVM_DIR from my bash_profile.

adding this:

export NVM_DIR="$HOME/.nvm"
  . "/usr/local/opt/nvm/nvm.sh"

to ~/.bash_profile fixed my problem

@jonknapp

This comment has been minimized.

jonknapp commented Feb 25, 2017

FYI, I had to add yarn global bin to PATH before I added NVM via Homebrew. Works great for me, yarn added through homebrew on Mac.

@zmorris

This comment has been minimized.

zmorris commented Mar 1, 2017

#630 (comment) worked for me as of Yarn 0.21.3 on Mac OS X 10.11.6. After I set the prefix, I removed and re-added packages and global access worked from then on (remember to re-open any terminal windows that might have your old PATH):

yarn config set prefix /usr/local/
yarn global remove <package>
yarn global add <package>

Can list installed packages with:

yarn global ls
@curtdp

This comment has been minimized.

curtdp commented Mar 2, 2017

Hello. I use fish shell with OMF on macOS and solved this problem by adding to my ~/.config/fish/config.fish file
set -x PATH $PATH $HOME"/.config/yarn/global/node_modules/.bin"

@alanmimms

This comment has been minimized.

alanmimms commented Mar 2, 2017

I have similar problems on KDE Neon (Ubuntu 16.04.2). But I think I see what's going on.
npm install -g is actually using as an install target directory what yarn global bin says it's using, but yarn is lying.

From the comment above by @curtdp I realized that yarn global add installs symlinks for module binaries in $HOME/.config/yarn/global/node_modules/.bin. When I install a package using a command like yarn global add bower it creates symlink $HOME/.config/yarn/global/node_modules/bin/bower.

But yarn global bin gives

/home/alan/.nvm/versions/node/v7.7.1/bin

This is a bug. Of course, we can all work around it by adding the directory path $HOME/.config/yarn/global/node_modules/bin to our shell's PATH, but really Yarn should be saying what it's doing and doing what it says with the yarn global bin command.

@darkbasic

This comment has been minimized.

darkbasic commented Apr 7, 2017

/usr/local/share/.config/yarn/global/package.json:
{ "dependencies": { "@angular/cli": "^1.0.0-beta.30" } }

But $ sudo yarn global ls:
yarn global v0.22.0 Done in 0.18s.

@OmgImAlexis

This comment has been minimized.

OmgImAlexis commented Apr 20, 2017

Duplicate: #2064

@jay763190097

This comment has been minimized.

jay763190097 commented Apr 28, 2017

i use this commond
yarn config set prefix "D:\Program Files (x86)\Yarn\node-global"
and add "D:\Program Files (x86)\Yarn\node-global" to PATH.
then
'yarn global add express-generator'
it add supervisor.cmd this file in "D:\Program Files (x86)\Yarn\node-global",
but when i use
express -V
An error occurred that means the file name, directory name, or volume label syntax is incorrect.

@OmgImAlexis

This comment has been minimized.

OmgImAlexis commented Apr 28, 2017

@jay763190097 this issue is about OSX not Windows.

@voxsim

This comment has been minimized.

Contributor

voxsim commented Apr 28, 2017

@bestander we can close this because it is a duplicated.

@bestander bestander closed this Apr 28, 2017

@bestander bestander added triaged and removed needs triage labels Apr 28, 2017

@tiendq

This comment has been minimized.

tiendq commented May 12, 2017

npm install -g is helpful this case :)

partounian added a commit to partounian/dotfiles that referenced this issue Jun 6, 2017

@enphnt

This comment has been minimized.

enphnt commented Jul 14, 2017

i know this is closed but in case others stumble, i saw a package just for this issue. $ npm install -g fix-yarn-global-packages

then just run it to relink packages. refer to: https://www.npmjs.com/package/fix-yarn-global-packages

@zh-h

This comment has been minimized.

zh-h commented Jul 17, 2017

yarn global bin

/usr/bin

But exactly binary file is here.

/usr/local/share/.config/yarn/global/node_modules/.bin/
@simplenotezy

This comment has been minimized.

simplenotezy commented Jul 31, 2017

I have two users on my MacOS. When I added this to path:

export PATH="$PATH:$(yarn global bin)"

I get error: zsh: permission denied: apidoc. Any ideas why?

@aislanmaia

This comment has been minimized.

aislanmaia commented Aug 6, 2017

I'm facing the same problem on KDE Neon (Ubuntu 16.04.2). Yarn version 0.27.5
yarn global bin returns /home/aislan/.asdf/installs/nodejs/7.2.1/.npm/bin

Having installed yarn through npm, to solving the problem just follow up the Yarn's guide that says:
To have access to Yarn’s executables globally, you will need to set up the PATH environment variable in your terminal. To do this, add export PATH="$PATH:yarn global bin" to your profile.

Since I'm using zsh, I put PATH command in .zshrc file.

@c01nd01r

This comment has been minimized.

c01nd01r commented Oct 13, 2017

"globalFolder": "/Users/c01nd01r/.config/yarn/global",
but yarn global bin
/usr/local/bin 🤔

@aristotll

This comment has been minimized.

aristotll commented Jan 8, 2018

@c01nd01r I have a similar situation.

@DanielRuf

This comment has been minimized.

DanielRuf commented Jul 18, 2018

Still the same here.

@denisinla

This comment has been minimized.

denisinla commented Sep 20, 2018

"globalFolder": "/Users/c01nd01r/.config/yarn/global",
but yarn global bin
/usr/local/bin 🤔

  • Your global directory is ~/.config/yarn/global (this is where yarn global add stores modules)
  • Your Yarn binary location is /usr/local/bin (I'm assuming you installed via homebrew?)

If you're having issues like I did earlier, I changed into ~/.config/yarn/global and removed package.lock(if any) and yarn.lock and tried a yarn global create-react-app install globally and it went back to normal.

@kahboom

This comment has been minimized.

kahboom commented Oct 22, 2018

I had the following:

$ yarn global bin
/usr/local/bin

$ yarn global dir
/Users/<me>/.config/yarn/global

Even yarn global remove <package> and re-adding didn't work, but the global directory did have the binary, so I knew there was a problem with the $PATH.

Worked: export PATH="$HOME/.config/yarn/global/node_modules/bin:$PATH"

Didn't work: export PATH="$(yarn global bin):$PATH"

Then just source ~/.bashrc (or wherever your bash settings are), and yarn global add <package> even though it already exists. That was the only thing that removed the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment