How to display yarn globally installed packages?

后端 未结 3 378
谎友^
谎友^ 2020-12-24 11:32

I am using MacOs Sierra 10.12.4 and I have installed yarn by brew install yarn and it\'s version is yarn version v0.23.2

I installed

相关标签:
3条回答
  • 2020-12-24 12:13

    I have did some research for a couple of days but haven't get quite helpful solutions. #2224 #3142 and some other Github issues relate to this.

    This is how I get the global installed packages so far:

    1. go to ~/.config/yarn/bin, it shows the packages but no version tags.
    2. go to ~/.config/yarn/global and run cat package.json to display the installed packages

    Content:

    {
        "dependencies": {
        "angular-cli": "^1.0.0-beta.28.3",
        "bower": "^1.8.0",
        "yo": "^1.8.5",
        "browser-sync": "^2.18.8",
        "cordova": "^6.5.0",
        "generator-jhipster": "^4.3.0",
        "ionic": "^2.2.2",
        "ts": "^0.0.0",
        "typescript": "^2.2.2"
        }
    }
    

    To check whether the info is accurate, I run yarn global remove yo, then yo is gone in the ~/.config/yarn/bin folder and then I cat package.json again and yo has removed from the file as well.

      "dependencies": {
        "angular-cli": "^1.0.0-beta.28.3",
        "bower": "^1.8.0",
        "browser-sync": "^2.18.8",
        "cordova": "^6.5.0",
        "generator-jhipster": "^4.3.0",
        "ionic": "^2.2.2",
        "ts": "^0.0.0",
        "typescript": "^2.2.2"
      }
    }
    

    npm works perfectly on my machine but yarn is much faster, that's why I don't want to go back to npm... Hope someone can provide more elegant way to achieve this.

    0 讨论(0)
  • 2020-12-24 12:22

    yarn global list has been fixed, see issue and pull request.

    0 讨论(0)
  • 2020-12-24 12:28

    yarn global list is currently broken, too. See the related issue.

    Currently I directly list Yarn global packages folder content:

    • Windows: %LOCALAPPDATA%/Yarn/config/global
    • OSX and Linux non-root: ~/.config/yarn/global
    • Linux if logged in as root: /usr/local/share/.config/yarn/global

    Update June 22, 2020

    As of May 12, 2017 this problem has been resolved. See issue and pull request.

    So you can use yarn global list to list all globally installed packages.

    0 讨论(0)
提交回复
热议问题