Yarn: Your current version of Yarn is out of date "npm upgrade --global yarn" should be "npm install --global yarn"

Created on 5 Apr 2017  ·  25Comments  ·  Source: yarnpkg/yarn

Current yarn: 0.19.1

bug

What is the current behavior?

The "yarn is out of date" message posts an npm command. This command doesn't succeed in updating yarn.

warning Your current version of Yarn is out of date. The latest version is "0.21.3" while you're on "0.19.1".
info To upgrade, run the following command:
$ npm upgrade --global yarn

But this command doesn't do it. yarn remains at 0.19.1

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

data-projector ❯ which yarn
/Users/crucial/.nvm/versions/node/v6.9.1/bin/yarn
data-projector ❯ npm upgrade --global yarn
data-projector ❯ yarn --version
0.19.1

data-projector ❯ npm --version
3.10.8

The npm command that works is install:

npm install --global yarn

yarn --version
0.21.3
data-projector ❯ npm install --global yarn
/Users/crucial/.nvm/versions/node/v6.9.1/bin/yarn -> /Users/crucial/.nvm/versions/node/v6.9.1/lib/node_modules/yarn/bin/yarn.js
/Users/crucial/.nvm/versions/node/v6.9.1/bin/yarnpkg -> /Users/crucial/.nvm/versions/node/v6.9.1/lib/node_modules/yarn/bin/yarn.js
- [email protected] node_modules/yarn/node_modules/end-of-stream/node_modules/once
- [email protected] node_modules/yarn/node_modules/exit-hook
- [email protected] node_modules/yarn/node_modules/gauge/node_modules/supports-color
- [email protected] node_modules/yarn/node_modules/generate-function
- [email protected] node_modules/yarn/node_modules/is-finite
- [email protected] node_modules/yarn/node_modules/is-property
- [email protected] node_modules/yarn/node_modules/generate-object-property
- [email protected] node_modules/yarn/node_modules/is-utf8
- [email protected] node_modules/yarn/node_modules/jsonpointer
- [email protected] node_modules/yarn/node_modules/is-my-json-valid
- [email protected] node_modules/yarn/node_modules/os-shim
- [email protected] node_modules/yarn/node_modules/pinkie
- [email protected] node_modules/yarn/node_modules/pinkie-promise
- [email protected] node_modules/yarn/node_modules/repeating
- [email protected] node_modules/yarn/node_modules/typedarray
- [email protected] node_modules/yarn/node_modules/concat-stream
- [email protected] node_modules/yarn/node_modules/spawn-sync
- [email protected] node_modules/yarn/node_modules/diff
- [email protected] node_modules/yarn/node_modules/user-home
/Users/crucial/.nvm/versions/node/v6.9.1/lib
└─┬ [email protected]

...

data-projector ❯ yarn --version
0.21.3

Now I know this sounds like an npm bug, certainly not a yarn bug.
According to npm docs it should be upgrade.

What is the expected behavior?

This:

https://github.com/yarnpkg/yarn/blob/24199a0091196144ba373e31afde199dc4e077ac/src/cli/commands/install.js#L93

should say:

return 'npm install --global yarn';

But honestly I'm not sure.

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

Node 6.9.1
npm 3.10.8
OS X el capitain

cat-bug cat-documentation good first issue triaged

Most helpful comment

There's a bit of a discussion on this on #1139 that ties into other issues.

npm install -g yarn solved the issue for me when nothing happened running npm update --global yarn.

Curious as to why there is a prompt for npm update --global yarn when the command doesn't do anything. And Yarn self-update is currently not available. Feels like there aren't any viable options other than doing an install.

All 25 comments

I'm closing this because it must be an npm bug. The command posted should be what npm documentation suggests.

There's a bit of a discussion on this on #1139 that ties into other issues.

npm install -g yarn solved the issue for me when nothing happened running npm update --global yarn.

Curious as to why there is a prompt for npm update --global yarn when the command doesn't do anything. And Yarn self-update is currently not available. Feels like there aren't any viable options other than doing an install.

npm install -g yarn is the only thing that works. The message should be updated, even though upgrade should work, it clearly doesn't.

+1 for changing the help text to npm install -g yarn. Some thoughts on why:

Though this indeed is technically an npm bug, the relevant GitHub issue ( https://github.com/npm/npm/issues/11534 ) has fallen victim to their new auto-close policy. Even if this was sneakily fixed at some point anyway, yarn users are now dependent on npm being up to date in order to ensure yarn's suggestion works, which is a weird pseudo-dependency.

In an ideal world, this would be fixed npm-side and the point would be moot, but I'd rather see yarn give consistently helpful documentation rather than rely on behavior of the tool it's meant to replace.

Is there a particular reason by the way why we can't use yarn to upgrade yarn?

I've installed yarn with brew now (OS X). Then it is available with any version of node I have active (I use nvm). Otherwise you have to install yarn in each node version global.

brew upgrade yarn

I use n instead of nvm and never have had to reinstall it globally for a
new version of Node (OS X too).

On Tue, Jun 27, 2017, 21:13 Chris Sattinger notifications@github.com
wrote:

I've installed yarn with brew now (OS X). Then it is available with any
version of node I have active (I use nvm). Otherwise you have to install
yarn in each node version global.

brew upgrade yarn


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/yarnpkg/yarn/issues/3042#issuecomment-311300773, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAd8QgK_Wz1jQpWoCIYD1LjoDKd0ipojks5sIMe6gaJpZM4MzyBN
.

I too faced the same warning.
I looked into api docs for upgrading the issue. But i ended up following the tutorial for installing yarn and installed it again. It upgraded my yarn and the above warning didnt show up when i ran the command(which was yarn install for my repo) again.

I encountered the same thing today, but the command is quite different :

warning Your current version of Yarn is out of date. The latest version is "1.0.2" while you're on "0.19.1".
info To upgrade, run the following command:
$ curl -o- -L https://yarnpkg.com/install.sh | bash

The command doesn't work either, unfortunately.

I noticed that too. Really don't know what's wrong with npm i -g yarn

On Thu, Sep 21, 2017, 12:14 Birkhoff Lee notifications@github.com wrote:

I encountered the same thing today, but the command is quite different :

warning Your current version of Yarn is out of date. The latest version is "1.0.2" while you're on "0.19.1".
info To upgrade, run the following command:
$ curl -o- -L https://yarnpkg.com/install.sh | bash

The command doesn't work either, unfortunately.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/yarnpkg/yarn/issues/3042#issuecomment-331015363, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAd8Qv2wDTxmBS37d7cfuKageRDEy6eOks5skapUgaJpZM4MzyBN
.

@BirkhoffLee that should work actually. What's the error you are getting?

Didn’t get any error or warnings. Everything looks fine but it just don’t work.

On Sep 21, 2017, 9:14 PM +0800, Burak Yiğit Kaya notifications@github.com, wrote:

@BirkhoffLee that should work actually. What's the error you are getting?

You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@BirkhoffLee The command displayed changes depending on how you've installed Yarn, so a different command isn't unusual.

On Mac npm install -g yarn didn't upgrade yarn for me, but then I noticed that I already had it installed with homebrew so uninstalled from there and then ln -s ~/.nvm/versions/node/v6.11.0/bin/yarn /usr/local/bin/yarn. I had stopped using it, but needed to reuse for a library which was using it.

Not sure if this will help anyone? I'm on macOS.
For people who have installed yarn with shell script like mentioning in here
And wanted to upgrade yarn with npm. You first need to rm -rf .yarn/ dir and then install yarn again with npm install -g yarn. Otherwise, you won't be able to use the newly installed yarn in your CLI. It will keep using the old one that you've installed with shell script.

When I did run npm install -g yarn
then I got the deprecated warning and it did nothing

npm WARN deprecated [email protected]: It is recommended to install Yarn using the native installation method for your environment.

So I fixed it for:
1) On Debian or Ubuntu Linux, you can install Yarn via our Debian package repository. You will first need to configure the repository:


curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

2) sudo apt-get update && sudo apt-get install yarn

Now my installed yarn version is updated

What helped me was:

  1. brew uninstall --force yarn.
  2. rm -rf ~/.yarn.
  3. npm install --global yarn

😎

brew uninstall --force yarn
rm -rf ~/.yarn
# follow instructions here https://yarnpkg.com/en/docs/install
# on macOS --without-node bc I use nvm
brew install yarn --without-node

For those with Homebrew: brew upgrade yarn worked just fine

It's nice and all that there are so many workarounds for Mac users but... surely, I'm not the only Windows user? curl doesn't exactly do anything there...

What's the problem with npm install -g yarn? Why was that not used for the warning instead of curl?

I can't update yarn by npm update --global yarn or npm install --global yarn

When I run the above it says 1.6.0 installed, however if i then run yarn --version it is stuck on 1.3.2.

I can't remember how I installed yarn to begin with.

(windows)

* UPDATE *

i had used choco, so choco upgrade yarn in an elevated shell worked for me

curl --compressed -o- -L https://yarnpkg.com/install.sh | bash

What helped me was:

  1. brew uninstall --force yarn.
  2. rm -rf ~/.yarn.
  3. npm install --global yarn

😎

This worked like a charm, cheers man!

Somebody needs to publish 1.15.2 to npm. https://www.npmjs.com/package/yarn It's showing 1.13.0 while stable on http://yarnpkg.com is 1.15.2

Just an FYI for anyone else running into this issue. It ended up I had apparently installed Yarn through a windows installer. It was finding this one first. I uninstalled it windows via Programs and Features and it then picked up the new one.

Was this page helpful?
0 / 5 - 0 ratings