2

I use coursier to set up the environment of Scala using command ./cs setup in Ubuntu 20.04 LTS. It was said that all the requirements were installed. However, when I use command scala -version to check whether the installation succeeded, it shown that Command 'scala' not found. The result of command. Reboot didn't work. So please help me to slove this problem! Thanks!

Information: An ECS with Ubuntu 20.04 LTS, user is not the root.

Jinhong Ye
  • 21
  • 2
  • 2
    Make sure you have something like this: `export PATH="$PATH:$HOME/.local/share/coursier/bin"` in either your `.bashrc` or `.profile` files. – Luis Miguel Mejía Suárez Apr 14 '22 at 13:35
  • @LuisMiguelMejíaSuárez Thank you for your suggestion and sorry for my replying late. I think it is helpful and I will try later if I rebuild my environment. – Jinhong Ye Apr 27 '22 at 15:37
  • Might have to wait for some time before changes are reflected. In my case(Windows 10 pro) I checked around for 15-20 min and then started manual installation. But after downloading openJDK(1st step for manual installation) when I tried to check the environment PATH it had the coursier path added to it and 'scala' command also worked. – Sachin Jul 24 '22 at 18:20

2 Answers2

3

I had the same issue, it looks like coursier is adding scala bin path to the ~/.profile file using double quotations:

# >>> coursier install directory >>>
export PATH="$PATH:/home/username/.local/share/coursier/bin"
# <<< coursier install directory <<<

So I removed the double quotations and it worked fine for me

# >>> coursier install directory >>>
export PATH=$PATH:/home/username/.local/share/coursier/bin
# <<< coursier install directory <<<

You can run this command in your terminal after updating the profile file, so the new changes takes effect immediately in your terminal with no need to log out or open a new terminal tab.

source ~/.profile
1

I had the same issue, coursier did modify my .bash_profile to include:

# >>> coursier install directory >>>
export PATH="$PATH:/home/james/.local/share/coursier/bin"
# <<< coursier install directory <<<

But that didn't work for me.

I had to edit the .bashrc and on the last line add:

export PATH="$PATH:$HOME/.local/share/coursier/bin"

You will have to run bash or logout and back in for it to take effect.

James Becwar
  • 1,176
  • 2
  • 11
  • 20
  • Yes! And thank you for your help. I gave up fixing it since I just want to run Chisel projects. It needs `sbt` and `JVM` at all and Courier is not necessary. – Jinhong Ye Apr 27 '22 at 15:34