trr266 / rescorptrans

The repository for our open online course "Research on Corporate Transparency"
MIT License
28 stars 18 forks source link

Deal with the Rscript error: No such file or directory #1

Open xumj2021 opened 3 years ago

xumj2021 commented 3 years ago

Got an issue when building the project

image

The issue can be settled by revising a line in the Makefile:

image From

RSCRIPT := Rscript --encoding=UTF-8

To

RSCRIPT := /Library/Frameworks/R.framework/Versions/Current/Resources/Rscript --encoding=UTF-8

In which "/Library/Frameworks/R.framework/Versions/Current/Resources/Rscript" is the absolute address where Rscript.exe is located in your computer.

image

I hope it helps if you are stuck with a similar issue :)

joachim-gassen commented 3 years ago

Thank you for reporting this! It seems that sometimes the installation on Mac fails to add symbolic links to the R executables. Normally they should be in the path.

You can verify this by opening the Mac Terminal App and typing

which Rscript

For me, this returns

Joachims-Air:~ joachim$ which Rscript
/usr/local/bin/Rscript

but for others it might return nothing indicating that Rscript is not in the path. A permanent solution to this problem would be to add the links manually.

Again, using the Terminal, create the links by:

cd /usr/local/bin
ln -s /Library/Frameworks/R.framework/Versions/Current/Resources/bin/Rscript Rscript
ln -s /Library/Frameworks/R.framework/Versions/Current/Resources/bin/R R

This should take care of the issue and also you help you in other cases where code relies on R/Rscript being in your path.