V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
githere
V2EX  ›  问与答

安装 yarn 出现 error,安装的 yarn 是 1.16.0 .为什么显示版本却是 1.3.2

  •  
  •   githere · 2019-06-02 06:23:49 +08:00 · 1683 次点击
    这是一个创建于 1762 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我是安装官网教程安装的 yarn https://yarnpkg.com/en/docs/install#mac-stable,环境是 macos

    $brew install yarn

    收到警告 Warning: yarn 1.16.0 is already installed, it's just not linked
    You can use `brew link yarn` to link this version.
    所以就执行了

    $ brew link yarn

    收到信息:Linking /usr/local/Cellar/yarn/1.16.0...
    Error: Could not symlink bin/yarn
    Target /usr/local/bin/yarn
    already exists. You may want to remove it:
    rm '/usr/local/bin/yarn'

    To force the link and overwrite all conflicting files:
    brew link --overwrite yarn

    To list all files that would be deleted:
    brew link --overwrite --dry-run yarn

    然后执行了
    $ rm '/usr/local/bin/yarn'
    $ brew link --overwrite yarn

    收到提示:Linking /usr/local/Cellar/yarn/1.16.0... 2 symlinks created

    执行:$ brew upgrade yarn

    得到错误:Error: yarn 1.16.0 already installed

    $ yarn --version
    1.3.2



    怎么会安装好的版本号跟提示的不一致, 查看了 stackoverflow 的教程,也无法升级上去啊
    4 条回复    2019-06-02 19:30:17 +08:00
    xinyusir
        1
    xinyusir  
       2019-06-02 10:05:12 +08:00 via iPhone
    which yarn 看一下
    githere
        2
    githere  
    OP
       2019-06-02 18:13:27 +08:00
    $ which yarn
    /Users/mycodeworld/.yarn/bin/yarn
    githere
        3
    githere  
    OP
       2019-06-02 18:13:37 +08:00
    githere
        4
    githere  
    OP
       2019-06-02 19:30:17 +08:00
    最终解决方法: https://segmentfault.com/a/1190000014720740 去这个文章把 你的 yarn 版本升级到最新的稳定版本,我的是 1.16.0 version.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5183 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 09:31 · PVG 17:31 · LAX 02:31 · JFK 05:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.