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 option doesn't allow system-wide installation of bin utils #1029

Closed
hyperknot opened this issue Oct 13, 2016 · 7 comments
Closed

global option doesn't allow system-wide installation of bin utils #1029

hyperknot opened this issue Oct 13, 2016 · 7 comments

Comments

@hyperknot
Copy link

hyperknot commented Oct 13, 2016

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

What is the current behavior?
Yarn installs to a user's or root's home folder, and links to that folder from /usr/bin.
Since on most Linux only the current user has access to it's home folder, only the user who run the install command can use the globally installed bin utils. For anyone else they get permission denied errors when trying to run the globally installed bin util.

What is the expected behavior?
Global install of bin utils should function like they were installed system-wide, like with apt-get or npm.

Please mention your node.js, yarn and operating system version.
node: 4.6.0, yarn: 0.15.0, OS: Ubuntu 16.04.1

@FLGMwt
Copy link
Contributor

FLGMwt commented Oct 14, 2016

yarn global respects the PREFIX environment variable which overrides the default /usr/bin

You can test the bin resolution with yarn global bin before and after setting the variable.

@hyperknot
Copy link
Author

hyperknot commented Oct 14, 2016

So the yarn global bin reports /usr/bin for both root and user. That would be all good, and is the same behaviour for npm.

The problem is where those modules are actually staying on the disk.

What npm install --global eslint, does is:

/usr/bin/eslint -> ../lib/node_modules/eslint/bin/eslint.js

While what yarn global add eslint does is:

/usr/bin/eslint -> ../../root/.yarn-cache/.global/node_modules/.bin/eslint

This breaks installation as no user other than root has access to /root/.yarn-cache.

I believe the recommended solution would be to use /usr/lib/node_modules or /usr/lib/yarn_modules or something for global modules.

@lucaskatayama
Copy link
Contributor

lucaskatayama commented Oct 14, 2016

@hyperknot Is that correct?

I believe the recommended solution would be to use /usr/lib/node_modules or /usr/bin/yarn_modules or something for global modules.

I think you meant /usr/lib/yarn_modules .. Right?

@hyperknot
Copy link
Author

Sorry, of course, edited my post.

@Fed03
Copy link

Fed03 commented Oct 14, 2016

I use brew to install node on my macOS.

NPM bin: /usr/local/bin
yarn bin: /usr/local/Cellar/node/6.7.0/bin

I don't know if it could be useful

@lucaskatayama
Copy link
Contributor

lucaskatayama commented Oct 21, 2016

My attempt to fix it

#1344

Daniel15 pushed a commit that referenced this issue Oct 31, 2016
* Fixing global add in linux root folder #1029

* Changing global path to /usr/local/share
@bestander
Copy link
Member

Seems fixed

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

No branches or pull requests

6 participants