首页 > 解决方案 > 在 Windows 10 下安装“ReporteRs”和“ReporteRsjars”时出错

问题描述

我被困在安装ReporteRsReporteRsjars从此链接

首先,我将在我的计算机上提供 R、Rstudio 和 Java 的版本。仅供参考,我已将它们安装在D:/驱动程序上C:/,我不确定这是否是导致问题的原因。

> R.version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          4                           
minor          1.1                         
year           2021                        
month          08                          
day            10                          
svn rev        80725                       
language       R                           
version.string R version 4.1.1 (2021-08-10)

Java版本:

> java -version
java version "17" 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)

从 github安装ReporteRsjars :

> library(devtools)
> library(rJava)
> devtools::install_github('davidgohel/ReporteRsjars')

出去:

Downloading GitHub repo davidgohel/ReporteRsjars@HEAD
√  checking for file 'C:\Users\LSTM\AppData\Local\Temp\Rtmpod8qJu\remotes368451f4ff9\davidgohel-ReporteRsjars-0adc2ca/DESCRIPTION' ...
-  preparing 'ReporteRsjars':
√  checking DESCRIPTION meta-information ... 
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
-  building 'ReporteRsjars_0.0.5.tar.gz'
   
* installing *source* package 'ReporteRsjars' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
No man pages found in package  'ReporteRsjars' 
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
Error: package or namespace load failed for 'ReporteRsjars':
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: JAVA_HOME cannot be determined from the Registry
Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'D:/R-4.1.1/library/ReporteRsjars'
* restoring previous 'D:/R-4.1.1/library/ReporteRsjars'
Warning message:
In i.p(...) :
  installation of package ‘C:/Users/LSTM/AppData/Local/Temp/Rtmpod8qJu/file36841715307/ReporteRsjars_0.0.5.tar.gz’ had non-zero exit status

要在本地安装ReporteRsjars

> install.packages("D:/Software/ReporteRsjars_0.0.4.tar.gz", repos = NULL, type = "source")
* installing *source* package 'ReporteRsjars' ...
** package 'ReporteRsjars' successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
No man pages found in package  'ReporteRsjars' 
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
Error: package or namespace load failed for 'ReporteRsjars':
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: JAVA_HOME cannot be determined from the Registry
Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'D:/R-4.1.1/library/ReporteRsjars'
* restoring previous 'D:/R-4.1.1/library/ReporteRsjars'
Warning in install.packages :
  installation of package ‘D:/Software/ReporteRsjars_0.0.4.tar.gz’ had non-zero exit status

要直接使用此链接中的命令安装ReporteRs

> cran_dir_url <- "https://cran.r-project.org/src/contrib/Archive/ReporteRs/ReporteRs_0.8.10.tar.gz"
> install.packages("ReporteRs", contriburl=cran_dir_url,
+                  repos = cran_dir_url, 
+                  type = 'source', INSTALL_opts = "--no-multiarch")

出去:

Warning in install.packages :
  unable to access index for repository https://cran.r-project.org/src/contrib/Archive/ReporteRs/ReporteRs_0.8.10.tar.gz:
  cannot open URL 'https://cran.r-project.org/src/contrib/Archive/ReporteRs/ReporteRs_0.8.10.tar.gz/PACKAGES'
Warning in install.packages :
  package ‘ReporteRs’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

任何人都可以帮助解决这个问题?非常感谢。

标签: rreporters

解决方案


推荐阅读