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 Fedora 24 #1371

Closed
joseluisq opened this issue Oct 22, 2016 · 12 comments
Closed

Global binaries don't install on Fedora 24 #1371

joseluisq opened this issue Oct 22, 2016 · 12 comments
Labels

Comments

@joseluisq
Copy link

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

What is the current behavior?
Global packages installation doesn't work.

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

I installed yarn package via sudo dnf install yarn

~> echo $PATH
/usr/local/bin /usr/local/sbin /usr/bin /usr/sbin /home/joseluis/.composer/vendor/bin /home/joseluis/.composer/vendor/bin /home/joseluis/.node/bin /home/joseluis/.yarn/bin

~> yarn global add surge
yarn global v0.16.0
warning No license field
[1/4] Resolving packages...
warning surge > fstream-ignore > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed [email protected] with binaries:
      - surge
error An unexpected error occured, please open a bug report with the information provided in "/home/joseluis/.yarn-config/global/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

~> tail -n 4 /home/joseluis/.yarn-config/global/yarn-error.log

Trace: 
  Error: EACCES: permission denied, unlink '/usr/bin/surge'
      at Error (native)

What is the expected behavior?
Global binaries sould be executable.

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

~> yarn version
yarn version v0.16.0
~> node -v
v4.6.0
~> npm -v
2.15.9
~> cat /etc/fedora-release
Fedora release 24 (Twenty Four)
~> fish -v
fish, version 2.3.1
@frodri
Copy link

frodri commented Oct 22, 2016

Can confirm similar behavior in Windows 10, version 1607. I'm using node 4.5.0, along with yarn 0.16.0.

~> "yarn global add typescript" output

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 [email protected] with binaries:
      - tsc
      - tsserver
error An unexpected error occured, please open a bug report with the information
 provided in "C:\\Users\\USERNAME\\AppData\\Local\\Yarn\\config\\global\\yarn-e
rror.log".
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this c
ommand.


~> last 4 lines of yarn-error.log

Trace: 
  Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\tsc'
      at Error (native)

@Daniel15
Copy link
Member

Interesting... Two issues I see here:

  1. Yarn should not be putting files in /usr/bin, only /usr/local/bin. /usr/bin is only for packages managed by the system (apt-get, yum, dnf, etc.)
  2. Yarn should not try putting files in /usr/bin or /usr/local/bin when the user doesn't have permission to write there. It should probably just use ~/.yarn/bin or something similar.

I think running sudo yarn global add should work though.

Does "dnf install yarn" use our package repo? I'm not very familiar with Fedora, but it looks like dnf is an updated version of yum?

@pgalkin
Copy link

pgalkin commented Oct 23, 2016

I think running sudo yarn global add should work though.I think running sudo yarn global add should work though.

Does not. I'm not using Fedora though, I'm using ArchLinux and installed yarn from the AUR and added $HOME/.yarn/bin to the $PATH. I also had to manually create these directories to stop my shell from complaining that such directory doesn't exist. The shell is fish 2.3.1, as @joseluisq's. Now I'm doing:

> sudo yarn global add create-react-app
yarn global v0.16.1
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed [email protected] with binaries:
      - create-react-app
Done in 12.43s.

> which create-react-app
which: no create-react-app in (bin/:/home/fixnum/.rbenv/bin/:/home/fixnum/gocode/bin:/home/fixnum/bin/:/home/fixnum/.yarn/bin:/home/fixnum/.rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)

Naturally, the first time I tried to install without sudo and I got the following error (which wasn't displayed in the terminal by the way, only in the log file):

Trace: 
  Error: EACCES: permission denied, symlink '../../home/fixnum/.yarn-config/global/node_modules/.bin/create-react-app' -> '/usr/bin/create-react-app'
      at Error (native)

Why ../../ at the beginning?

node is 6.9.1, I don't have npm yet.

Yarn should not try putting files in /usr/bin or /usr/local/bin when the user doesn't have permission to write there. It should probably just use ~/.yarn/bin or something similar.

I'm wondering why not simply use ~/.yarn/bin for all global binaries and never even try to use /usr/local/bin?

@pgalkin
Copy link

pgalkin commented Oct 23, 2016

Relevant issue #648

@onemen
Copy link

onemen commented Oct 23, 2016

I get the same permission error In Window 10 when yarn global add try to link bins to
yarn global bin which is C:\Program Files\nodejs
I reported #1226

@joseluisq
Copy link
Author

joseluisq commented Oct 24, 2016

Interesting... Two issues I see here:

  1. Yarn should not be putting files in /usr/bin, only /usr/local/bin. /usr/bin is only for packages managed by the system (apt-get, yum, dnf, etc.)
  2. Yarn should not try putting files in /usr/bin or /usr/local/bin when the user doesn't have permission to write there. It should probably just use ~/.yarn/bin or something similar.

I think running sudo yarn global add should work though.

Does "dnf install yarn" use our package repo? I'm not very familiar with Fedora, but it looks like dnf is an updated version of yum?

@Daniel15
Yep, dnf is the next version of yum it operates similarly. (Compatible with rpm packages too)

In any case, yarn should allow to set a custom binary path somehow. Maybe similar to npm:

~> cat ~/.npmrc
prefix = /home/my-local-user/.node/bin

@tonico
Copy link

tonico commented Oct 24, 2016

Adding export PREFIX=~/.local to my .bash_profile (followed by source ~/.bash_profile) fixed it for me. Yarn now links binaries to ~/.local/bin, which is in my PATH.

@pgalkin
Copy link

pgalkin commented Oct 25, 2016

I briefly went over the issues and found some of the related ones: #1389, #1388, #1321, #1226, #1194, #1151, #1060, #1029, #927 (comment), #630.

@andyyou
Copy link

andyyou commented Nov 4, 2016

Similar issue on macOS, I use nvm for my node environment. When I install a new version of node then yarn global does't install pkg correctly

btw I use brew to install yarn.

The information as follow

System Software Overview:

      System Version: macOS 10.12.1 (16B2555)
      Kernel Version: Darwin 16.1.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal

@balthild
Copy link

balthild commented Nov 15, 2016

Similar issue. I use macOS. I use homebrew to install node and yarn.

$ yarn global add vue-cli
yarn global v0.16.1
warning No license field
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
success Installed [email protected] with binaries:
      - vue
      - vue-init
      - vue-list
✨  Done in 1.75s.

$ vue
zsh: command not found: vue

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

$ /usr/local/Cellar/node/7.1.0/bin/vue

  Usage: vue <command> [options]


  Commands:

    init        generate a new project from a template
    list        list available official templates
    help [cmd]  display help for [cmd]

  Options:

    -h, --help     output usage information
    -V, --version  output the version number

I could solve this problem temporary by adding /usr/local/Cellar/node/7.1.0/bin into $PATH. But anytime homebrew get nodejs updated, I must change my ~/.profile manually.

@indolering
Copy link

Shouldn't this be marked as dupe of #1194?

@joseluisq
Copy link
Author

joseluisq commented Feb 10, 2017

This issue is solved now in v0.19.1

For example I have achieved to install surge globally.
Here log (I have ~/.npmrc prefix cofigured with my local path):

~> sudo dnf install yarn
~> yarn version  
0.19.1
~> cat ~/.npmrc
prefix=/home/joseluis/.node
~> yarn config get prefix
/home/joseluis/.node
~> yarn global bin
/home/joseluis/.node/bin
~> yarn global add surge
yarn global v0.19.1
warning No license field
[1/4] Resolving packages...
warning surge > fstream-ignore > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning surge > request > [email protected]: use uuid module instead
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
      - surge
warning No license field
Done in 3.04s.
~> surge --version
0.18.0

Yarn reads the prefix path in ~/.npmrc file:

~> npm config get prefix
/home/joseluis/.node
~> yarn config get prefix
/home/joseluis/.node

Deleting prefix... (for testing only)

~> sed -i '/prefix=/d' ~/.npmrc
~> npm config get prefix
/usr
~> yarn config get prefix
undefined

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

9 participants