Skip to content
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 · 38 comments
Closed

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

selfagency opened this issue Oct 20, 2016 · 38 comments
Labels

Comments

@selfagency
Copy link

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
Copy link

same problem. 0.16.x is buggy

@timche
Copy link

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
Copy link

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
Copy link

zerovox commented Oct 26, 2016

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

@sharat
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

@gekorob thanks for the tips

@gekorob
Copy link

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
Copy link

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
Copy link
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
Copy link

iddan commented Jan 30, 2017

same here

@selfagency
Copy link
Author

this works for me as of v0.19.1

@broven
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

/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
Copy link

Duplicate: #2064

@jay763190097
Copy link

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
Copy link

@jay763190097 this issue is about OSX not Windows.

@voxsim
Copy link
Contributor

voxsim commented Apr 28, 2017

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

@tiendq
Copy link

tiendq commented May 12, 2017

npm install -g is helpful this case :)

@enphnt
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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

@aristotll
Copy link

@c01nd01r I have a similar situation.

@DanielRuf
Copy link
Contributor

Still the same here.

@denisinla
Copy link

"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
Copy link

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.

@sfengyuan
Copy link

Yarn was installed via apt on Ubuntu, I have to add this to .zshrc,

' not work: export PATH="$HOME/.config/yarn/global/node_modules/bin:$PATH"
export PATH="$(yarn global bin):$PATH"

@brenobarnard
Copy link

On windows in my case i just run

yarn global bin

and set the returned path in Environment Variables on PATH, in my case was:

C:\Users\<user>\AppData\Local\Yarn\bin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests