Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

command 'scala' not found after set up by coursier

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.

like image 1000
Jinhong Ye Avatar asked Nov 01 '25 06:11

Jinhong Ye


2 Answers

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
like image 101
Mahmoud Rizk Avatar answered Nov 04 '25 01:11

Mahmoud Rizk


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.

like image 25
James Becwar Avatar answered Nov 04 '25 01:11

James Becwar