Yarn command not setup or working Linux Mint 18.2 Cinnamon

Viewed 572

So I have been having problems with the fact that my yarn was out of date (1.5.1).

I desperately wanted to upgrade but no answer has helped me. So then I went and I thought I uninstalled yarn on both npm and apt. yarn -v was still 1.5.1.

I had before updated yarn using both npm and apt and they had said they had updated to the newest yarn. However the command clearly does not go to their versions.

I did which yarn The response was some file path. I decided I would nuke the whole folder it was sitting in.

That did work but now no matter how I reinstall yarn I can't get the command to work it points to the old path given by: which yarn Then continues to complain it can't find anything there.

Here is a little output of removing cmdtest / yarn / then reinstalling yarn:

doom@doom-MacBookPro ~ $ which yarn
/usr/local/bin/yarn
doom@doom-MacBookPro ~ $ yarn
-bash: /home/doom/.yarn/bin/yarn: No such file or directory
doom@doom-MacBookPro ~ $ sudo apt remove cmdtest && sudo apt remove yarn && sudo apt install yarn
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'cmdtest' is not installed, so not removed
The following packages were automatically installed and are no longer required:
  containerd libdb5.3++ libfltk1.1 libllvm4.0 libllvm4.0:i386 libllvm5.0
  libllvm5.0:i386 libmikmod3 libosmesa6 libportmidi0 libsdl-mixer1.2
  libsdl-ttf2.0-0 libsmpeg0 libtinyxml2.6.2v5 mokutil python-numpy
  python-pygame runc ttf-dejavu-core
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 106 not upgraded.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  containerd libdb5.3++ libfltk1.1 libllvm4.0 libllvm4.0:i386 libllvm5.0
  libllvm5.0:i386 libmikmod3 libosmesa6 libportmidi0 libsdl-mixer1.2
  libsdl-ttf2.0-0 libsmpeg0 libtinyxml2.6.2v5 mokutil python-numpy
  python-pygame runc ttf-dejavu-core
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  yarn
0 upgraded, 0 newly installed, 1 to remove and 106 not upgraded.
After this operation, 4 596 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 387271 files and directories currently installed.)
Removing yarn (1.10.1-1) ...
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  containerd libdb5.3++ libfltk1.1 libllvm4.0 libllvm4.0:i386 libllvm5.0
  libllvm5.0:i386 libmikmod3 libosmesa6 libportmidi0 libsdl-mixer1.2
  libsdl-ttf2.0-0 libsmpeg0 libtinyxml2.6.2v5 mokutil python-numpy
  python-pygame runc ttf-dejavu-core
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  yarn
0 upgraded, 1 newly installed, 0 to remove and 106 not upgraded.
Need to get 0 B/796 kB of archives.
After this operation, 4 596 kB of additional disk space will be used.
Selecting previously unselected package yarn.
(Reading database ... 387254 files and directories currently installed.)
Preparing to unpack .../archives/yarn_1.10.1-1_all.deb ...
Unpacking yarn (1.10.1-1) ...
Setting up yarn (1.10.1-1) ...
doom@doom-MacBookPro ~ $ yarn -v
-bash: /home/doom/.yarn/bin/yarn: No such file or directory
doom@doom-MacBookPro ~ $ 

In my .bashrc

export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"

Some extra info:

doom@doom-MacBookPro ~ $ whereis yarn
yarn: /usr/bin/yarn /usr/local/bin/yarn /usr/share/yarn
doom@doom-MacBookPro ~ $ yarn -v
-bash: /home/doom/.yarn/bin/yarn: No such file or directory

Thank you very much for your time and I really hope someone has a better idea of what to do then I do.

I suspect somewhere the command part is setup so that it forces a point to a particular path...

Instead of doing that manually I would really prefer if the install setup the command, as that seems to be how everyone else acts like their yarn works.

EDIT

So right before I got it working I did enter this:

doom@doom-MacBookPro ~ $ yarn -v
-bash: /home/doom/.yarn/bin/yarn: No such file or directory
doom@doom-MacBookPro ~ $ man yarn
No manual entry for yarn
See 'man 7 undocumented' for help when manual pages are not available.
doom@doom-MacBookPro ~ $ export PATH="$PATH:$(yarn global bin)"
-bash: /home/doom/.yarn/bin/yarn: No such file or directory
doom@doom-MacBookPro ~ $ yarn global
yarn global v1.10.1
error Invalid subcommand. Try "add, bin, dir, ls, list, remove, upgrade, upgrade-interactive"
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

Then I literally did:

doom@doom-MacBookPro ~ $ yarn global -v
1.10.1
doom@doom-MacBookPro ~ $ cd Desktop/
doom@doom-MacBookPro ~/Desktop $ cd Rails
doom@doom-MacBookPro ~/Desktop/Rails $ yarn -v
1.10.1

So somehow it is working now. Not sure but happy.

1 Answers
Related