Yarn upgrade to the latest

Yarn is a package manager for JavaScript created by Facebook. 

Find current version

$ yarn –version

Current version on my machine is 0.27

I followed below steps to complete upgrade process.

Remove yarn setup
$ sudo apt autoremove yarn

Add repository with latest version
$ 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

Install yarn
$ sudo apt-get update
$ sudo apt-get install yarn


Installation process is not completed. It showed error message on file. That file can not be overwritten.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
yarn
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/697 kB of archives.
After this operation, 4,436 kB of additional disk space will be used.
(Reading database ... 228278 files and directories currently installed.)
Preparing to unpack .../archives/yarn_1.7.0-1_all.deb ...
Unpacking yarn (1.7.0-1) ...
dpkg: error processing archive /var/cache/apt/archives/yarn_1.7.0-1_all.deb (--unpack):
trying to overwrite '/usr/bin/yarn', which is also in package cmdtest 0.27-1
Errors were encountered while processing:
/var/cache/apt/archives/yarn_1.7.0-1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Solution was to overwrite the file manually with following command.
$ sudo dpkg -i –force-overwrite

Actual command executed
$ sudo dpkg -i --force-overwrite /var/cache/apt/archives/yarn_1.7.0-1_all.deb

Following response was displayed as result of above command.
(Reading database ... 228278 files and directories currently installed.)
Preparing to unpack .../archives/yarn_1.7.0-1_all.deb ...
Unpacking yarn (1.7.0-1) ...
dpkg: warning: overriding problem because --force enabled:
dpkg: warning: trying to overwrite '/usr/bin/yarn', which is also in package cmdtest 0.27-1
Setting up yarn (1.7.0-1) …

Again, installation command was executed.
$ sudo apt-get install yarn

Result for installation. It is completed.
Reading package lists... Done
Building dependency tree
Reading state information... Done
yarn is already the newest version (1.7.0-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Check the latest version.
$ yarn --version

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s