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

yarn global ls does not display package names #2446

Closed
lotap opened this issue Jan 13, 2017 · 11 comments
Closed

yarn global ls does not display package names #2446

lotap opened this issue Jan 13, 2017 · 11 comments

Comments

@lotap
Copy link

lotap commented Jan 13, 2017

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

What is the current behavior?
yarn global ls does not display package names - only displays warnings, so it is difficult to interpret which package is causing which warning.

yarn global ls response

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

What is the expected behavior?
a list of packages

Please mention your node.js, yarn and operating system version.
node v7.2.0 via nvm
yarn 0.18.1
OSX 10.11.4

@lotap
Copy link
Author

lotap commented Jan 13, 2017

Further information: the unmet peer dependancy warnings are all eslint-plugin packages.
if eslint is installed globally, they do not appear in the list of packages at all (another bug?). If eslint is not installed, the warning above is produced.

@mjyut
Copy link

mjyut commented Jan 20, 2017

I understood this behavior of the yarn command.
The location where packages are installed with yarn global add depends on the user.

(Here is the Linux case)

  • root user
    When the root user executes add to global (e.g. sudo yarn global add package), the package is saved in /usr/local/share/.config/yarn/global/.
    To see the list of packages installed here, you need to run the command as root user (e.g. sudo yarn global ls).

  • general users
    When a general user executes add to global (e.g. yarn global add package), the package is saved in /home/USER/.config/yarn/global/.
    To see the list of packages installed here, you need to execute the command as the same general user (e.g. yarn global ls).

(I think that the meaning of "global" in Yarn is ambiguous. )

@psafont
Copy link

psafont commented Feb 3, 2017

In my case, npm packages are installed under /usr/lib/node_modules. yarn doesn't list them even when executing the command as root user, while npm lists them even when running as a normal user.

@mjyut
Copy link

mjyut commented Feb 3, 2017

@psafont I think packages that exist in /usr/lib/node_modules were installed by the npm command before.
yarn and npm use a different installation location.
The yarn command (sudo yarn global ls) displays only what was installed with yarn (sudo yarn global add).

@psafont
Copy link

psafont commented Feb 3, 2017

They were not, they were installed using pacman (arch's package manager).

So I take this bug report is a different issue from the install location being incompatible between yarn's and npm's, right?

@mjyut
Copy link

mjyut commented Feb 3, 2017

(I apologize for my poor English)
It is a simple behavior.
The yarn command displays only packages that were installed with the yarn command.
It does not display packages installed by npm command or by package manager of Linux distribution (e.g. pacman).


And I think this is not a bug.
It is the specification of Yarn.
Yarn developers do not recommend installing packages in $NODE_PATH.
This is to prevent situations in which your project depends on packages not included in package.json.

@psafont
Copy link

psafont commented Feb 3, 2017

And I think this is not a bug.
It is the specification of Yarn.
Yarn developers do not recommend installing packages in $NODE_PATH.

Then all is clear, thanks

@lotap
Copy link
Author

lotap commented Feb 8, 2017

@mjyuta the bug I was reporting was specifically about not showing the names of the packages producing warnings. Please look at the screenshot, it is not the normal list of packages you expect with yarn global ls

I was trying to remove some global packages, but couldn't remember all of their names. I tried running yarn global ls to get a list of them, but only got a list of warnings with no information about the origin of the warning. (These packages were installed with yarn global add)

I have resolved my particular issue because I had a list of the package names I needed to remove elsewhere.

@mjyut
Copy link

mjyut commented Feb 9, 2017

@lotap Did you use "sudo" for both "add" and "ls"?

@elyscape
Copy link

elyscape commented Jun 8, 2017

In addition to warnings, yarn global ls currently lists binaries provided by global packages:

scapeless:~ elyscape$ yarn global ls
yarn global v0.24.6
warning No license field
info "node-gyp@3.6.2" has binaries:
   - node-gyp
✨  Done in 0.41s.
scapeless:~ elyscape$ cat ~/.config/yarn/global/package.json
{
  "dependencies": {
    "node-gyp": "^3.6.2",
    "yarn-completion": "github:dsifford/yarn-completion"
  }
}

Two thoughts about this:

  1. The warning that there is no license field doesn't make a lot of sense here.
  2. yarn global ls really should list the packages installed globally, rather than their binaries. I shouldn't have to look in ~/.config/yarn/global/package.json to remember what packages I've installed. The binary listing functionality could perhaps be moved to yarn global ls-bin or put behind a flag like yarn global ls --binaries.

@rally25rs
Copy link
Contributor

This should be fixed in latest Yarn. See #3142

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

No branches or pull requests

5 participants