It is fun that we have this at beginning of the template:
<!-- *Before creating an issue please make sure you are using the latest version of yarn.* -->
Do you want to request a feature or report a bug?
A bug, maybe.
What is the current behavior?
yarn --version returns 0.18.1, but I installed 0.19.1
If the current behavior is a bug, please provide the steps to reproduce.
A Debian or Debian-based OS, like Ubuntu, is required.
wget https://yarnpkg.com/downloads/0.19.1/yarn_0.19.1_all.debsudo dpkg -i yarn_0.19.1_all.debyarn --versionIt shows 0.18.1 to me.
What is the expected behavior?
I expected see 0.19.1, to confirm I am using the latest version of yarn.
Please mention your node.js, yarn and operating system version.
It worths mentioning that I previously had 0.18.1 installed, following the same "download and install deb package" procedure. I've been upgrading this way since many versions ago.
Given what happened this time, I took care of purging yarn from the system, and then trying again. Got same results.
I don't know if 0.19.1 is reporting wrong version, or if the file to download at yarnpkg.com/downloads is providing the old version, even though the filepath is of the new version...
I see the same error on Windows 10. Uninstalled yarn completely, then installed version 0.19.1. Open a new console and yarn --version reports 0.18.1
Can you locate via package.json via which yarn? What version does it have?
The version may be overridden by a previous self-update.
Check if there is a self-update folder and nuke it
I have searched for "self-update" folder with find ./ -name self-update and it gave no results.
Currently I am at this point:
jbruni@vm:~$ which yarn
/usr/bin/yarn
Then as root:
root@vm:/usr/bin# ls -la yarn*
lrwxrwxrwx 1 root root 22 Jan 16 21:44 yarn -> ../share/yarn/bin/yarn
lrwxrwxrwx 1 root root 22 Jan 16 21:44 yarnpkg -> ../share/yarn/bin/yarn
root@vm:/usr/bin# cd /usr/share/yarn
root@vm:/usr/share/yarn# grep -rl 0.18.1 *
node_modules/node-gyp/gyp/tools/emacs/testdata/media.gyp.fontified
node_modules/node-emoji/lib/emojifile.js
updates/0.17.10/node_modules/node-gyp/gyp/tools/emacs/testdata/media.gyp.fontified
updates/0.17.10/node_modules/node-emoji/lib/emojifile.js
updates/0.17.10/yarn.lock
updates/0.18.1/node_modules/node-gyp/gyp/tools/emacs/testdata/media.gyp.fontified
updates/0.18.1/node_modules/node-emoji/lib/emojifile.js
updates/0.18.1/package.json
updates/0.18.1/yarn.lock
root@vm:/usr/share/yarn# rm -rf updates
I nuked this /usr/share/yarn/updates folder.
Then:
jbruni@vm:~$ yarn --version
/usr/share/yarn/bin/yarn.js:61
throw err;
^
Error: ENOENT: no such file or directory, open '/usr/share/yarn/updates/0.18.1/lib/cli/index.js'
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.fs.readFileSync (fs.js:508:33)
at Object.Module._extensions..js (module.js:578:20)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/share/yarn/bin/yarn.js:53:22)
This is where I am at this very moment.
Now I'm putting console.log statements in this /usr/share/yarn/bin/yarn.js...
console.log(YARN_VERSION) prints 0.19.1 - which is taken from the package.json from the parent folder.
But the error message is still that one shown above:
(Error: ENOENT: no such file or directory, open '/usr/share/yarn/updates/0.18.1/lib/cli/index.js'
And console.log(possibles) prints [ '../updates/current/lib/cli/index.js', '../lib/cli/index.js' ]
I will keep looking...
Does ../updates/current still exist?
No, updates folder is still nuked...
According to code yarn reads updates/current which is a symlink that was linking to /usr/share/yarn/updates/0.18.1 earlier.
Try restarting computer maybe :)
I think the self-update feature is too confusing and it is better to get rid of it.
What do you think?
I restarted it, but it gives very same error. From where it is taking this "0.18.1"? Why is it trying to load a module from an inexistent folder?
/usr/share/yarn/bin/yarn.js line 17: possibles.push('../updates/current/lib/cli/index.js');
updates/current is supposed to be a symlink and it was pointing to updates/0.18.1 for you previously.
It is very strange that after removing it it is still able to read the symlink
Well... issue resolved now.
This is what I ended up doing:
root@vm:/# find ./ -name yarn
./home/jbruni/.npm/registry.npmjs.org/yarn
./home/jbruni/.npm/yarn
./home/jbruni/.config/yarn
./home/jbruni/.cache/yarn
./home/jbruni/Downloads/yarn
./home/jbruni/Downloads/yarn/bin/yarn
./usr/share/doc/yarn
./usr/share/lintian/overrides/yarn
./usr/share/yarn
./usr/share/yarn/bin/yarn
./usr/bin/yarn
Then I did rm -rf for each one of all entries above.
Next:
root@vm:/# apt-get purge yarn
And, finally:
root@vm:/# cd /home/jbruni/Downloads
root@vm:/home/jbruni/Downloads# dpkg -i yarn_0.19.1_all.deb
Whatever was messing has been removed, and now yarn runs, with yarn --version printing 0.19.1.
It would be handy to have a "self-update" and something to manage versions built-in. But since current implementation is confusing, better remove it, and let it for a separated project (like nvm is for node). Let Yarn focus on its own task...
Yeah, I think we have caches to Node requires via .roadrunner, this one was causing the trouble.
./home/jbruni/.config/yarn
Thanks for investigating a bit more
I removed everything yarn-related from my drive (Windows 10) and then installed again. Now my version is correctly 0.19.1
Use alternative method to update yarn https://yarnpkg.com/en/docs/install#alternatives-tab
Run this on cli, curl -o- -L https://yarnpkg.com/install.sh | bash