Skip to content

Install globally can be misleading #1335

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

Closed
maxleiko opened this issue Oct 21, 2016 · 3 comments
Closed

Install globally can be misleading #1335

maxleiko opened this issue Oct 21, 2016 · 3 comments

Comments

@maxleiko
Copy link

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

What is the current behavior?
When you type yarn add global typings in fact you are installing the modules global & typings locally to your module package.json, which can be misleading when you come from the npm world where every install begins the same: npm install [...args]
In the yarn world, you can install in two ways:

  • yarn add [...args]
  • yarn global add [...args]

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

What is the expected behavior?
I think that there should be some discussions around the install process to prevent such mixing in the developper's head. Maybe global should not be a plain word but a dashed argument just like --dev

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

  • Node.js v6.5.0
  • Yarn v0.16.1
  • Linux Mint "rafaela" x86_64
@rchanou
Copy link

rchanou commented Mar 4, 2017

I think at least a note in the docs would be nice, so I made a pull request for that.

@callumlocke
Copy link

I don't like the proposed solution, but there is definitely a problem here. I've installed this package by accident too many times. I don't think a note in the docs is going to help much. I know the order, but I still get it wrong.

How about this: whenever the user runs yarn add global <SOMETHING ELSE>, that is:

  • when they try to add more than one package at once
  • as regular, local dependencies (not --dev etc)
  • and the first one in their list is named "global"

...you can infer that the user almost certainly intdned to do yarn global add foo... instead. So in this particular case, yarn could exit (with code 1) and a message something like this:

Did you mean "yarn global add ..." ?

If you really want to install the package named "global" locally,
please install it *individually* with "yarn add global".

@gsklee
Copy link
Contributor

gsklee commented May 23, 2017

@bestander close

The docs now cover this caveat: https://yarnpkg.com/en/docs/cli/global

Semantic-wise I think it's also very reasonable to expect this outcome. I don't think there's any ambiguity here.

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

7 participants